This week's book giveaway is in the OCMJEA forum.
We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line!
See this thread for details.
The moose likes Servlets and the fly likes Handling session timeout and session invalidate differently Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Handling session timeout and session invalidate differently" Watch "Handling session timeout and session invalidate differently" New topic
Author

Handling session timeout and session invalidate differently

Kumar Gaurav
Ranch Hand

Joined: Apr 08, 2008
Posts: 108
Howdy Ranchers,

In my application i am using spring web flow, JSF (richfaces). I have a doubt and that is how can i differentiate between session timeout and a call to session.invalidate().

Because in case of session time out i want to redirect user to a Page A and in case user logs out of application i am invalidating the session and want user to redirect to login page.

Any pointer how can i achieve this because i am not able to handle session timeout and call to session.invaidate() differently.


Regards,
Gaurav
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61106
    
  66

As you are the one invalidating the session, you can take whatever action you want afterwards. There's no need for detection as you know when you are invalidating the session.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Madhan Sundararajan Devaki
Ranch Hand

Joined: Mar 18, 2011
Posts: 312

I believe, using HttpSession.getLastAccessedTime() and HttpSession.getMaxInactiveInterval() APIs you may be able to acheive the needful.


S.D. MADHAN
Not many get the right opportunity !
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Handling session timeout and session invalidate differently