apache基于ssl配置weblogic(三)
7. 使用struts2-ssl-plugin来拦截https请求如果使用struts2作为web mvc框架,那么可以使用struts2-ssl-plugin来拦截ssl请求
其实就是封装了struts2拦截器,用于重定向https请求。
一开始认为需要在配置文件新建一个package用于定义ssl请求,其实大可不必,因为需要继承的ssl-default就继承了struts-default,如果原package继承struts-default,就可以将原来的package都继承ssl-default
<package name="xx" extends="ssl-default" namespace="/xx">
..
</package>
另外需要定义拦截器:
<interceptors>
<interceptor-stack name="secureStack">
<interceptor-ref name="secure">
<param name="httpsPort">443</param>
<param name="useAnnotations">true</param>
</interceptor-ref>
<interceptor-ref name="defaultStack"/>
</interceptor-stack>
</interceptors>
还有需要注意的是,如果在action中定义了其他拦截器,那么在定义的action处必须显示定义secureStack。
如果useAnnotations属性设定为false的时候,那么整个继承ssl-default的package的所有action都将变成https请求,如果设置成true,那么只有标记为@Secured的方法才会被重定向为https,否则将会定向为http
页:
[1]