关于resin的 session 的持久化(存储) (一) 2008-11-11 15:17
首先 session的定义我不用说了。
第二 resin.conf的格式我也不再复述。
第三 一下说的是resine2的版本,是2.1.7或2.1.8。resin3的pro才有我要说的功能 ,不过要收费。
我要实现的功能就是用户正登录着呢,重启 服务,session还是继续有、继续保留,用户点击,不会重新登录、不用重新登陆。
关于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>
配置时需要注意的就是存储位置,尽量每个webapp用自己的位置,不要公用目录,我本机测试会产生问题。
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 |
以上配置方式有以下几种(我没都试过,有兴趣的自己去test):
1,第一种格式为例子中的格式
2,<session-config session-timeout='120'/><!--session-timeout 为属性-->
3,<session-config>
<session-timeout id=120/>
<session-max id=4096/>
</session-config>
先写到这里,如果session没有重新载入进来,就看下一篇,下一篇也木有办法,我也木有办法。