3

Is there any way to manage the following scenario using Spring:

I have to logout the user if he is inactive for 30 minutes. However, on the elapse of the 28th minute, I have to display a warning pop-up saying that the user will be logged out in 2 more minutes. If the user responds his session is maintained. Otherwise, his session expires in 2 minutes and he is redirected to the home page.

Using Spring 3.0.

*Spring is handling all my session management and the servlet container is Tomcat. The requirements of the client I am working for that any functionality created should function well without javascript as well. This is why I was searching for a Spring based solution.

msegf
  • 81
  • 7
  • Is Spring doing your session management? I think that feature is typically provided by the servlet container. What servlet container are you using? Tomcat? JBoss? etc? – Pace Jun 27 '13 at 12:35
  • Really interesting question. Actually I don't know if it's possible to catch a session timeout event (either from spring or servlet container) before the session got closed. The problem here will be to prevent the session from being closed/invalidated. – alain.janinm Jun 27 '13 at 13:33

1 Answers1

0

Sounds like a job for Javascript on the client, rather than something Spring would do.

If you know (or set) the session timeout on the server, you can set a corresponding timer on the client, to go off 2mins prior to the actual session expiry.

If required you can always force the session to end by redirecting the page to the logout URL from Javascript. If your logout destination is set to the home page, then that's where the user would end up.

Community
  • 1
  • 1
Shaun the Sheep
  • 22,353
  • 1
  • 72
  • 100