session持久化设置

原文地址:点击打开链接


Apache Tomcat Configuration Reference


The Manager Component


Special Feature:


  Persistence Across Restarts

    
     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 (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="" />

    

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值