Resin 的mod_caucho插件不解析filter的問題
因为struts2的服务方式为filter方式,而Resin的mod_caucho插件正常情况下仅会对Servlet,Jsp服务,不会对Filter过滤的网址服务,这给struts2在Resin上使用带来一些问题。这可使用"Special servlet-mappings",详细情况可以参考
http://www.caucho.com/resin-3.0/install/plugin-dispatch.xtp。
也就是说,对于一些特殊的url,可以使用plugin_match来让resin来服务,而plugin_ignore的作用正好相反。在这里,我们需要plugin_match,为了避免打乱正常的配置,我们使用和web.xml文件相同作用的resin-web.xml来设置相应的url,这样设置仅对resin有效,不影响其他server,还是不错的。
最后的resin-web.xml是这样的:
<web-app xmlns="
http://caucho.com/ns/resin">
<servlet-mapping url-pattern='/struts/*' servlet-name='plugin_match'/>
<servlet-mapping url-pattern='/other/*' servlet-name='plugin_match'/>
<servlet-mapping url-pattern='*.action' servlet-name='plugin_match'/>
<servlet-mapping url-pattern='*.html' servlet-name='plugin_match'/>
<servlet-mapping url-pattern='*.do' servlet-name='plugin_match'/>
<servlet-mapping url-pattern='/dwr/*' servlet-name='plugin_match'/>
</web-app>
这样struts2的action就可以正常工作了。
另外,如果url后面自动跟上jsessionid的话,resin会反应404找不到网页的错误。在host里配置里加上<session-config enable-cookies='true' enable-url-rewriting='false'/>可避免这个问题。