This week's book giveaway is in the Java 8 forum.
We're giving away four copies of Java 8 in Action and have Raoul-Gabriel Urma, Mario Fusco, and Alan Mycroft on-line!
See this thread for details.
The moose likes Servlets and the fly likes Handling Session Timeout Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Handling Session Timeout" Watch "Handling Session Timeout" New topic
Author

Handling Session Timeout

manish ahuja
Ranch Hand

Joined: Oct 23, 2003
Posts: 312
Hi All

I have a web app which uses form based authentication.

I have a (collection) maintained in the session .

The page in question has a button which fetches the collection already set in the session & displays to the user. This works fine normally.

But suppose the user is on the current page & is inactive for a long time & in the midst the session time out happens. Now the user clicks on the button he gets a login page because of session timeout. The user enters his credentials & the app server directs him to the same page which lists the collection but since the session has time out the collection no longer exists in the session.
On this login the app server does not direct him to the normal route which we have defined but it just tries to complete the request requested by the user & prompts a login page to handle session timeout

Has anyone encountered this scenario.

Do let me know how to get around this problem

Regards
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12683
    
    5
If you want the Collection to last longer than the session you will have to provide for it specifically - for example by serializing the collection and saving it in a database or file with the key or filename based somehow on the user's identity.
If you make the collection part of a data holding class that implements HttpSessionBindingListener you can use the valueUnbound method to save the contents.
Bill


Java Resources at www.wbrogden.com
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Handling Session Timeout
 
Similar Threads
Listening for events from different app
Auto Session logoff
Session timeout manamement
My http session not expiring after the specified time
Websphere timeout?