Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Changing the default session timeout of a spring web application

I have to test a web application that is written by spring and jsp. The default session-timeout for the application is 30 min.

I want to reduce the session-timeout. For doing this, I have changed in the web.xml file in tomcatInstallationLocation/conf/. But it doesn't work. The default configuration in tomcatInstallationLocation/conf/web.xml was -

<session-config>     <session-timeout>30</session-timeout> </session-config> 

Where I've just changed the time and make it -

<session-config>     <session-timeout>5</session-timeout> </session-config> 

But is still doesn't work. As I know far, in this situation I have to make a change in my spring application's web.xml. But I'm not sure. Can any one help me?

Thanks in advance.

like image 337
HassanF Avatar asked Oct 17 '12 10:10

HassanF


People also ask

How do I set session timeout in Spring Security?

Spring Security Session Timeout In the case of Tomcat we can set the session timeout by configuring the maxInactiveInterval attribute on the manager element in server. xml or using the session-timeout element in web. xml. Note that the first option will affect every app that's deployed to the Tomcat instance.

What is default session timeout in spring boot?

After deploying the war file manually to tomcat, I realized that default session timeout value (30 min) was being used still.


1 Answers

Session timeout hierarchy:

  • $tomcat_home/conf/web.xml
  • $your_webapp/WEB-INF/web.xml
  • manual invocation of HttpSession.setMaxInactiveInterval(int)

Each subsequent entry overrides others above.

like image 77
mindas Avatar answered Oct 06 '22 01:10

mindas