This week's book giveaway is in the Jython/Python forum.
We're giving away four copies of Murach's Python Programming and have Michael Urban and Joel Murach on-line!
See this thread for details.
Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Trace session of the user  RSS feed

 
Rakesh Gadre
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If a user has logged in a web application and he closes the browser without logging out. What happens to that session ? Is there any way to find out whether a client is still connected with the application or not ? (Something like isClientConnected in ASP) ?
rakesh
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13078
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This comes up alot so you might try a search for more information.
Basicallly, the servlet engine will invalidate the session after a certain period of inactivity. The default value is 30 minutes but you can change that in web.xml:

You can also change the timeout in a specific session object.
Since HTML does not maintain a connection, there is no way built in to servlets of knowing if the client is still "at" your site. There are various tricks, but they involve processes that run on the client browser.
You can use one of the "Listener" interfaces to be notified when a session is invalidated.
Bill
 
Rakesh Gadre
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks williams, but my requirement is slightly different.
It goes like this :
Once a client makes a request, the processing starts on the server which takes about 2-3 minutes to complete. In the meantime, if the client closes the browser or shifts to another site, further processing of his request is meaningless.
So, by the time the server is in processing mode, I want to keep a check whether client is still connected or not.
Thanks in advance.
Rakesh Gadre
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13078
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Like I said, this comes up a LOT. Search the last few weeks of this forum.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!