I am using Vaadin 7.1.7 and I can't figure out how to set session-timeout
parameter (to, say, 1min).
As far as I can tell, Vaadin 7.x.x does not produce web.xml
, it uses @VaadinServletConfiguration
annotation but there doesn't seem to be a session-timeout
parameter.
As far as I know there are 2 ways to set session-timeout in Vaadin 7.
In the web.xml:
<session-config>
<session-timeout>1</session-timeout> <!-- 1 minute -->
</session-config>
<servlet>
<servlet-name>MyServlet</servlet-name>
<servlet-class>com.xyz.web.MyServlet</servlet-class>
<init-param>
<description>My Main Page</description>
<param-name>UI</param-name>
<param-value>com.xyz.web.MyUI</param-value>
</init-param>
<init-param>
<description>Enable Session Timeout (heartbeat can't keep alive)</description>
<param-name>closeIdleSessions</param-name>
<param-value>true</param-value>
</init-param>
</servlet>
<servlet-mapping>
<servlet-name>MyServlet</servlet-name>
<url-pattern>/*</url-pattern>
</servlet-mapping>
Or we can set it programmatically (current session only):
VaadinSession.getCurrent().getSession().setMaxInactiveInterval(60); // 1 minute
It seems the servlet 3.0 annotations do not help: link
More help here: link
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With