Hi, I am polling to a servlet which results in "No Session Time Out". Is there any way to time out session while polling?
A:
You could put the sessionId (key) and timestamp (value) in a static HashMap on creation (indicated by session.isNew()
).
And check during polling in your servlet whether you want to time out the session, which
could be performed by invoking session.invalidate()
http://download-llnw.oracle.com/javaee/1.2.1/api/javax/servlet/http/HttpSession.html#invalidate%28%29
stacker
2010-08-24 09:21:30
but what if i was using application and continous polling doing?
Zeeshan
2010-08-24 09:36:40
@Zeeshan I'm not sure what you mean. You should describe which behaviour you expect.
stacker
2010-08-24 10:17:29
@Zeeshan If the client polls a again a new session will be created. So the client should stop polling. After invalidating the session on server side you could send an error response instead of OK to signal this to the client.
stacker
2010-08-24 12:04:27