Welcome to my Tomcat tutorials website!

mercoledì 30 aprile 2014

Tomcat session timeout

Tomcat session timeout is defined into the CATALINA_HOME/conf/web.xml file by the following directive:
<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">

    <session-config>
        <session-timeout>30</session-timeout>
    </session-config>
</web-app>
You can however override the default session timeout by setting in your application's WEB-INF/web.xml file the session timeout as well.

The number in session-timeout tag is in minutes. To make it unlimited or no time out, simply set the number to -1 and restart your Tomcat Service.
<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">

    <session-config>
        <session-timeout>-1</session-timeout>
    </session-config>
</web-app>

Nessun commento:

Posta un commento