Servlet 2.4 Specification 中的描述:
The default timeout period for sessions is defined by the servlet container and
can be obtained via the getMaxInactiveInterval method of the HttpSession
interface. This timeout can be changed by the Developer using the
setMaxInactiveInterval method of the HttpSession interface. The timeout
periods used by these methods are defined in seconds. By definition, if the timeout
period for a session is set to -1, the session will never expire. The session
invalidation will not take effect until all servlets using that session have exited the
SESSIONS
60
service method. Once the session invalidation is initiated, a new request must not
be able to see that session.
就看产品有没有无bug完整的实现这个规范了
setMaxInactiveInterval这样定义的 Specifies the time, in seconds, between client requests before the servlet container will invalidate this session.
我在页面里查过了默认是1800
不过我把MaxInactiveInterval设为1过一点时间确实会过期,恢复到1800,内容清为null