session.setMaxInactiveInterval(-1) 是否意味着,session将永久在服务器端保存?

hckxzy 2011-12-21 11:18:46
session.setMaxInactiveInterval(-1) 是否意味着,session将永久在服务器端保存?
...全文
375 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
若鱼1919 2011-12-21
  • 打赏
  • 举报
回复
servlet-3_0-final-spec.pdf,P80

7.5 Session Timeouts

In the HTTP protocol, there is no explicit termination signal when a client is no
longer active. This means that the only mechanism that can be used to indicate when
a client is no longer active is a time out period.
The default time out period for sessions is defined by the servlet container and can
be obtained via the getMaxInactiveInterval method of the HttpSession interface.
This time out can be changed by the Developer using the setMaxInactiveInterval
method of the HttpSession interface. The time out periods used by these methods
are defined in seconds. By definition, if the time out 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 service method. Once the session
invalidation is initiated, a new request must not be able to see that session.

wang7535067 2011-12-21
  • 打赏
  • 举报
回复
是的,A negative time indicates the session should never timeout.

67,515

社区成员

发帖
与我相关
我的任务
社区描述
J2EE只是Java企业应用。我们需要一个跨J2SE/WEB/EJB的微容器,保护我们的业务核心组件(中间件),以延续它的生命力,而不是依赖J2SE/J2EE版本。
社区管理员
  • Java EE
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧