我在系统中有一个过滤器,设置如下
       <filter>
<filter-name>CharacterSet Encoding</filter-name>
<filter-class>com.wafersystems.coss.filter.EncodingFilter</filter-class>
    
<init-param>
<param-name>encoding</param-name>
<param-value>gbk</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>CharacterSet Encoding</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
现在有一个webservice方面开发,URL为http://192.168.0.128:8080/coss/xfireService/CustInfoService?wsdl,
我想请教一下如何设置可以实现连接URL中含有xfireService时,过滤器不对它进行过滤!!!!!!!!!

解决方案 »

  1.   

    这个只能在 doFilter 中判断 URL 了。web.xml 中 utl-pattern 并不能设置除了 /xfireService 路径外的其他路径
      

  2.   

    1楼的回答很正确啊,只能在EncodingFilter中的doFilter()方法中添加判断来实现过滤了。public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
            // Conditionally select and set the character encoding to be used
        String url = request.getRequestURL();    // 获取URL请求
            if (url.indexOf("xfireService") != -1) {    // URL请求字符串中含有xfireService时……
                // 添加你的过滤代码
            }
            chain.doFilter(request, response);
        }