2016-11-03 63 views
0

當我重新啓動tomcat容器時,如果我停止tomcat,我的應用程序應該轉到索引頁面(或登錄頁面),但是它允許我轉到該視圖。當我從eclipse中刪除tomcat並重新創建tomcat服務器並啓動時,它只會重定向到索引。 tomcat如何管理我在以前的服務器啓動時創建的會話?Tomcat如何管理會話?

回答

2

默認的tomcat配置是將會話狀態保存到磁盤並在下次啓動時重新加載它。從Tomcat文檔[1]:

每當Tomcat是Apache正常關閉並重新啓動,或當 應用程序重新加載被觸發,該標準Manager實現 將嘗試序列化所有當前活動的會話到磁盤文件 通過路徑名屬性找到。當應用程序重新加載完成時,所有這些已保存的會話將被反序列化並激活(假設它們在 的平均時間內未到期)。

這是可配置的並且可以被禁用:

Every web application by default has standard manager implementation configured, and it performs session persistence across restarts. To disable this persistence feature, create a Context configuration file for your web application and add the following element there: 

<Manager pathname="" /> 

[1]的正式文檔:http://tomcat.apache.org/tomcat-7.0-doc/config/manager.html#Disable_Session_Persistence