Google Answers Logo
View Question
 
Q: Session problem using a combo of javascript and java servlet ( No Answer,   0 Comments )
Question  
Subject: Session problem using a combo of javascript and java servlet
Category: Computers > Programming
Asked by: amazingclick-ga
List Price: $5.00
Posted: 11 Jun 2003 09:39 PDT
Expires: 11 Jul 2003 09:39 PDT
Question ID: 216044
I have a scenario in which I place a javascript in a website which
calls a java servlet every 5 seconds and sends information about the
page it is in along with other details such as browser etc. etc.. Now
the first time such a request comes, java servlet creates a session
and thereafter tracks all the user response coming from that
javascript in that particular session. Now, on the other end, I have a
javascript which calls the java servlet every 10 seconds and lists all
the sessions. The functionality is that the user is able to track who
all are there on their site as every session is unique and he is able
to determine who all have visited what pages. Now, the problem coming
is some people donot allow setting of cookies (session is a cookie),
so, the problem comes is that every 5 seconds the javascript keeps
submitting information to the servlet and the servlet keeps creating
new sessions every 5 seconds which is wrong. We went around this
problem by checking whether the client end is allowing setting of
cookies. If the client end allows setting of cookies, only then we
send the request to the servlet for creation of sessions. But, we are
stuck in another scenario. In browsers like netscape, I think there is
a functionality that you can allow normal cookies but, not allow
sessions cause we are getting a lot of requests from netscape in which
new sessions keep being made. Any idea how we can stop this from the
client side. Can javascript make sessions and check if they are
created and stop requests from coming to our server.

Request for Question Clarification by endo-ga on 11 Jun 2003 18:59 PDT
Hi,

In your servlet, I assume you have a line that says something like:
HttpSession session = request.getSession(true);
Try replacing it with:
HttpSession session = request.getSession(false);

Then check if session is null or not before proceding.

Please let me know what the outcome is after that change.

If that does not fix your problem, can you please post some of the
code you're using.

Thanks.
endo
Answer  
There is no answer at this time.

Comments  
There are no comments at this time.

Important Disclaimer: Answers and comments provided on Google Answers are general information, and are not intended to substitute for informed professional medical, psychiatric, psychological, tax, legal, investment, accounting, or other professional advice. Google does not endorse, and expressly disclaims liability for any product, manufacturer, distributor, service or service provider mentioned or any opinion expressed in answers or comments. Please read carefully the Google Answers Terms of Service.

If you feel that you have found inappropriate content, please let us know by emailing us at answers-support@google.com with the question ID listed above. Thank you.
Search Google Answers for
Google Answers  


Google Home - Answers FAQ - Terms of Service - Privacy Policy