axis2+struts攔截地址衝突問題

axis2和struts在整合過程當中,struts會把axis的地址也攔截了,默認當成一個action處理,apache

會由於找不到action而報錯;app

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>      

兩種解決辦法:url

一.在struts.xml配置文件中加入排除過濾的地址spa

1 <constant name="struts.action.excludePattern" value="/services.*"/>

value中的「.」符號是必須的,如過濾地址爲  「/services/*」   value必須配置爲 "/services.*".net

二.重寫默認struts過濾類code

  具體步驟可參考這篇文章:http://blog.csdn.net/lishengbo/article/details/5474044xml

相關文章
相關標籤/搜索