axis2+struts拦截地址冲突问题
axis2和struts在整合过程中,struts会把axis的地址也拦截了,默认当成一个action处理,
会因为找不到action而报错;
1 <!-- struts配置 --> 2 <filter> 3 <filter-name>struts2</filter-name> 4 <filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class> 5 </filter> 6 <filter-mapping> 7 <filter-name>struts2</filter-name> 8 <url-pattern>/*</url-pattern> 9 </filter-mapping>
1 <!-- axis配置 --> 2 <servlet> 3 <servlet-name>AxisServlet</servlet-name> 4 <servlet-class>org.apache.axis2.transport.http.AxisServlet</servlet-class> 5 <load-on-startup>1</load-on-startup> 6 </servlet> 7 <servlet-mapping> 8 <servlet-name>AxisServlet</servlet-name> 9 <url-pattern>/services/*</url-pattern> 10 </servlet-mapping>
两种解决办法:
一.在struts.xml配置文件中加入排除过滤的地址
1 <constant name="struts.action.excludePattern" value="/services.*"/>
value中的“.”符号是必须的,如过滤地址为 “/services/*” value必须配置为 "/services.*"
二.重写默认struts过滤类
具体步骤可参考这篇文章:http://blog.csdn.net/lishengbo/article/details/5474044