• 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

Session Timeout handeling

 
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello,
Im working with jsp's n servlets in WSAD 5.0. In my application the server session timeout value has been set through the server administration console to 30 minutes. Now I need to display a warning message "Your session is about to expire" 2 minutes prior to session expires. So is there ne way throught which i can get the server session timeout value in the my application at run time.
Please help.

Thanks
Kaustubh
 
Ranch Hand
Posts: 304
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Why dont you create a httpsessionlistener class? It has two methods which you have to override...

sessioncreated(httpsessionevent) and sessiondestroyed(httpsessionevent). You can write your display message in sessiondestroyed method. So, just before the session is ended the sessiondestroyed is called and your message will be displayed.

If you want to display it exactly 2 minutes before the session expires. I am not sure about how you should go about it.
[ April 10, 2007: Message edited by: Atul Savant ]
 
Marshal
Posts: 28141
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Atul Savant:
If you want to display it exactly 2 minutes before the session expires. I am not sure about how you should go about it.

Yes, that's the impossible part. Your server only responds to requests, so if the client never sends you any more requests then you can't do this notification. And if you think about it for a bit, the client may not even have a page of your web application displayed. They might be checking their e-mail, or they might have turned off their computer.

The usual way to keep track of the client's time before session expiry is via Javascript on the client. But that's a subject for a different forum.
 
reply
    Bookmark Topic Watch Topic
  • New Topic