Home > Net >  How to access Session Timeout Value in web.xml?
How to access Session Timeout Value in web.xml?

Time:05-05

I want to implement idle session Timeout on the server-side in my web application. I'm using the Tomcat server.

  <session-config>
    <session-timeout>10</session-timeout>
  </session-config>

I can able to create an idle Session Timeout of 10 minutes but I also want to notify users if the timer is going to expire. Example: If only 2 minutes remaining in Timer, then I'll create a modal window displaying "Your session is going to expire, press ok to continue your session"

For those activities, I need to access and modify the session Timeout value.

My question is,

  1. Is it possible to access the session configuration?
  2. If yes, how to access it?
  3. If no, what are the other ways to perform these actions?

Thanks in advance!

CodePudding user response:

You can get the configured timeout from the session itself, use getMaxInactiveInterval. It gives you the time in seconds.

  • Related