Setting Vaadin session-timeout parameter
Asked Answered
T

1

6

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.

Targum answered 12/11, 2013 at 1:44 Comment(1)
possible duplicate of Getting rid of web.xml in Vaadin 7 with VaadinServletBurgonet
O
7

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

Owades answered 9/9, 2014 at 16:29 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.