由于一些低端手机不支持cookie,造成登录不上,在网上也查过都用url重写(a.普通方式实现 b.jstl-<c:url/> c.webwork-<ww:url/>)来实现,要是若大的项目都这么来工作量会很大,最终找到了一个解决方法采用resin url rewrite来传递jsessionid,以下配置为resin4.0.23
1.resin.conf默认配置中,jsessionid以cookie的方式在页面传递,即:
<session-config> <enable-url-rewriting>false</enable-url-rewriting> </session-config>
2.使用url rewrite有两种方式:
a.http://www.test.com/login.action;jsessionid=asdfasdfg2312?...
这种是将jsessionid放在action后面,需要修改resin/conf/resin.conf中的配置为:
<host id="" root-directory="/usr/work/deploy/mobile"> <web-app id="/" root-directory="."> <session-config> <!--<reuse-session-id>true</reuse-session-id>--> <enable-cookies>false</enable-cookies> <enable-url-rewriting>true</enable-url-rewriting> </session-config> </web-app> </host>
b.http://www.test.com/~jid=asdfasdfg2312/login.action?...
还要在resin/conf/resin.conf中增加session-url-prefix的设置:
<cluster id="app-tier"> ... <session-url-prefix>/~jid=</session-url-prefix> ... <host id="" root-directory="/usr/work/deploy/mobile"> <web-app id="/" root-directory="."> <session-config> <!--<reuse-session-id>true</reuse-session-id>--> <enable-cookies>false</enable-cookies> <enable-url-rewriting>true</enable-url-rewriting> </session-config> </web-app> </host> </cluster>
参考:
http://www.caucho.com/resin-4.0/admin/deploy-ref.xtp#sessionconfig