Setting Vaadin session-timeout parameter

别等时光非礼了梦想. 提交于 2019-12-05 06:02:29
Krayo

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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!