【转】关于resin的 session 的持久化(存储) (一)
遇到项目菜单容易在30分钟后出现timeout页面超时,提示用户重新登录问题,已在项目配置文件web.xml中查找未发现配置timeout的相关配置。
但用户反馈每30分钟出现此情况。
检查服务器配置resin.conf尚未配置session的timeout参数。在以下材料中的值如果服务器不配置则默认session-timeout为30分钟,且若服务器配置resin.conf与项目配置web.xml同时配置timeout,则服务器配置优先级最高。
关于resin的session配置例子如下,session持久化的配置:
<session-config>
<session-max>16686</session-max>
<session-timeout>40</session-timeout>
<enable-cookies>true</enable-cookies>
<enable-url-rewriting>true</enable-url-rewriting>
<file-store>WEB-INF/sessions</file-store><!-- 存储位置-->
<always-load-session>true</always-load-session>
</session-config>
session-config的其它配置参数如下。
session-config |
Attribute | Meaning | Default |
---|---|---|
session-timeout | The session timeout in minutes | 30 minutes |
session-max | Maximum active sessions | 4096 |
enable-cookies | Enable cookies for sessions (resin 1.1) | true |
enable-url-re writing | Enable URL rewriting for sessions (resin 1.1) | true |
cookie-version | Version of the cookie spec for sessions (resin 1.2) | 1.0 |
cookie-domain | Domain for session cookies (resin 1.2) | none |
cookie-max-age | Max age for persistent session cookies (resin 2.0) | none |
cookie-length | Maximum length of the cookie. (resin 2.1.1) | Integer.MAX_VALUE |
file-store | Persistent sessions using a file store (resin 1.2) | none |
jdbc-store | Persistent sessions using a JDBC store (resin 1.2) | none |
tcp-store | Persistent sessions using a distributed ring (resin 1.2) | none |
always-load-session | Reload data from the store on every request (resin 1.2) | false |
always-save-session | Save session data to the store on every request (resin 1.2) | false |
save-on-shutdown | Only save session when the application shuts down. (resin 1.2.3) | false |
reuse-session-id | Reuse the session id even if the session has timed out. (resin 2.0.4) | true |
ignore-serialization-errors | When persisting a session, ignore any values which don‘t implement java.io.Serializable | false |
1,第一种格式为例子中的格式
2,<session-config session-timeout=‘120‘/><!--session-timeout 为属性-->
3,<session-config>
<session-timeout id=120/>
<session-max id=4096/>
</session-config>