📜  java 会话超时 - Java 代码示例

📅  最后修改于: 2022-03-11 14:52:48.554000             🧑  作者: Mango

代码示例1
Setting session timeout globaly. It can be done by implementing ServletContextListener
@Override
public void contextInitialized(ServletContextEvent servletContextEvent) {      
    servletContextEvent.getServletContext().setSessionTimeout(timeinminutes);
}

For specific User we can get the session from Request (HttpServletRequest) 
e.g request.getSession().setMaxInactiveInterval(timeinsecond);