Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Session Timeout handeling  RSS feed

 
Kaustubh Hande
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • 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
 
Atul Sawant
Ranch Hand
Posts: 304
  • Mark post as helpful
  • send pies
  • 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 ]
 
Paul Clapham
Sheriff
Posts: 22185
38
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • 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.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!