gpt4 book ai didi

java - 使用 Tomcat 的 Java Web 应用程序中的 session 何时过期

转载 作者:行者123 更新时间:2023-12-01 21:58:58 25 4
gpt4 key购买 nike

我在开发 Web 应用程序时使用 tomcat 服务器。今天我看到一种情况。 我停止了服务器并在 5 秒后再次启动。然后之前的 session 就没有了 已过期。原因是什么。 session 具体何时过期?

提前致谢..

最佳答案

Whenever Apache Tomcat is shut down normally and restarted, or when an application reload is triggered, the standard Manager implementation will attempt to serialize all currently active sessions to a disk file located via the pathname attribute. All such saved sessions will then be deserialized and activated (assuming they have not expired in the mean time) when the application reload is completed.

这是 Tomcat 7 文档 here 的引用

您可以通过更改 context.xml 中的配置来关闭此行为:

<Manager>
...
<saveOnRestart>false</saveOnRestart> (by default is true)
</Manager

关于java - 使用 Tomcat 的 Java Web 应用程序中的 session 何时过期,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16250680/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com