cxf 和struts2 整合问题
系统中用到webservice,经火龙果指点使用了cxf,现在配置、访问都可以了,但在和struts2整合时问题出现了:
struts2的FilterDispatcher过滤所有的请求
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern/*</url-pattern>
</filter-mapping>
cxf配置到ws目录下
<servlet-mapping>
<servlet-name>CXFServlet</servlet-name>
<url-pattern>/ws/*</url-pattern>
</servlet-mapping>
这样struts2就把cxf的请求给拦截了,导致访问webservice不成功,如果去掉struts2的配置则webservice访问可以正常进行,现在想找一个方法是cxf和struts2能共存,谢谢大家!!
我试过
修改struts2的拦截为:
<filter-name>struts2</filter-name>
<url-pattern>/struts/*</url-pattern>
<url-pattern>/frame/*</url-pattern>
<url-pattern>*.action</url-pattern>
</filter-mapping>
这样不可以,访问带有struts2 标签的jsp页面会出错,org.apache.jasper.JasperException: The Struts dispatcher cannot be found. This is usually caused by using Struts tags without the associated filter. Struts tags are only usable when the request has passed through its servlet filter, which initializes the Struts dispatcher needed for this tag.