我正在尝试将Sniffy探查器添加到JSF项目中。
根据documentation web.xml需要使用以下过滤器进行更新:
<filter>
<filter-name>sniffer</filter-name>
<filter-class>io.sniffy.servlet.SnifferFilter</filter-class>
<init-param>
<param-name>inject-html</param-name>
<param-value>true</param-value>
</init-param>
<init-param>
<param-name>enabled</param-name>
<param-value>true</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>sniffer</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
但是web.xml已经包含一个过滤器:
<filter>
<filter-name>Character Encoding Filter</filter-name>
<filter-class>org.primefaces.titan.filter.CharacterEncodingFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>Character Encoding Filter</filter-name>
<servlet-name>Faces Servlet</servlet-name>
</filter-mapping>
<servlet>
<servlet-name>Faces Servlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>*.jsf</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>*.xhtml</url-pattern>
</servlet-mapping>
添加嗅探器过滤器(并且工作正常)字符编码过滤器停止工作(字符乱码)。
web.xml应该如何使这两个过滤器都有效?