• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Trace session of the user

 
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Posts: 13078
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Like I said, this comes up a LOT. Search the last few weeks of this forum.
reply
    Bookmark Topic Watch Topic
  • New Topic