原文地址:点击打开链接
Apache Tomcat Configuration Reference
The Manager Component
Special Feature:
Persistence Across Restarts
pathname
attribute. All such saved sessions will then be deserialized and (assuming they have not expired in the mean time) when the application reload is completed.
In order to successfully restore the state of session attributes, all such attributes MUST implement the java.io.Serializable
interface. You MAY cause the Manager to enforce this restriction by including the<distributable>
element in your web application deployment descriptor (/WEB-INF/web.xml
).
不论Apache Tomcat正常关闭还是重启,或者是应用程序重新加载被触发,标准管理实现类将尝试序列化当前所有的会话,通过pathname属性存储到磁盘文件上。所有这样的会话将在应用程序重新加载之后被反序列化并且激活。
为了成功的还原所有会话属性,所有的属性必须实现java.io.Serializable接口。你可以在你的web程序描述部署符中改变Manager实现类来强制执行这一约束。
Disable Session Persistence
As documented above, every web application by default has standard manager implementation configured, and it performs session persistence across restarts. To disable this persistence feature, create a Contextconfiguration file for your web application and add the following element there:
<Manager pathname="" />
如上文所述,每一个web程序默认会通过manager实现类配置,并且通过重启表现出session持久化特性。要使使这一特性失效,可以为你的web程序创建一个Context配置文件,加入以下元素:
<Manager pathname="" />