我正在使用primefaces 6.0和WebSphere 8.0,我想在我的webApp中实现GZip。经过大量研究后我才知道使用omnifaces GzipResponseFilter我可以使用Gzip压缩技术。 这是我的web.xml:
<?xml version="1.0" encoding="UTF-8"?>
<web-app id="WebApp_ID" version="3.0"
xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd">
<display-name>pla.web</display-name>
<servlet>
<servlet-name>FacesServlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>FacesServlet</servlet-name>
<url-pattern>*.xhtml</url-pattern>
<url-pattern>/faces/*</url-pattern>
</servlet-mapping>
<session-config>
<session-timeout>30</session-timeout>
</session-config>
<filter>
<filter-name>gzipResponseFilter</filter-name>
<filter-class>org.omnifaces.filter.GzipResponseFilter</filter-class>
<init-param>
<description>The threshold size in bytes. Must be a number between 0 and 9999. Defaults to 150.</description>
<param-name>threshold</param-name>
<param-value>150</param-value>
</init-param>
<init-param>
<description>The mimetypes which needs to be compressed. Must be a commaseparated string. Defaults to the below values.</description>
<param-name>mimetypes</param-name>
<param-value>
text/plain, text/html, text/xml, text/css, text/javascript, text/csv, text/rtf,
application/xml, application/xhtml+xml, application/x-javascript, application/javascript, application/json,
image/svg+xml, image/gif, application/x-font-woff, application/font-woff2, image/png
</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>gzipResponseFilter</filter-name>
<url-pattern>/*</url-pattern>
<dispatcher>REQUEST</dispatcher>
<dispatcher>ERROR</dispatcher>
</filter-mapping>
<error-page>
<exception-type>java.lang.Throwable</exception-type>
<location>/</location>
</error-page>
<filter>
<filter-name>PrimeFaces FileUpload Filter</filter-name>
<filter-class>org.primefaces.webapp.filter.FileUploadFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>PrimeFaces FileUpload Filter</filter-name>
<servlet-name>FacesServlet</servlet-name>
</filter-mapping>
<context-param>
<param-name>javax.faces.DATETIMECONVERTER_DEFAULT_TIMEZONE_IS_SYSTEM_TIMEZONE</param-name>
<param-value>true</param-value>
</context-param>
<!-- do not render comments -->
<context-param>
<param-name>javax.faces.FACELETS_SKIP_COMMENT</param-name>
<param-value>true</param-value>
</context-param>
<!-- do not ignore empty input fields -->
<context-param>
<param-name>javax.faces.INTERPRET_EMPTY_STRING_SUBMITTED_VALUES_AS_NULL</param-name>
<param-value>true</param-value>
</context-param>
<context-param>
<param-name>javax.faces.PROJECT_STAGE</param-name>
<param-value>Production</param-value>
</context-param>
<!-- validate also empty fields -->
<context-param>
<param-name>javax.faces.VALIDATE_EMPTY_FIELDS</param-name>
<param-value>true</param-value>
</context-param>
<context-param>
<param-name>primefaces.THEME</param-name>
<param-value>daimler</param-value>
</context-param>
<context-param>
<param-name>javax.faces.STATE_SAVING_METHOD</param-name>
<param-value>server</param-value>
</context-param>
<context-param>
<param-name>org.apache.myfaces.NUMBER_OF_VIEWS_IN_SESSION</param-name>
<param-value>128</param-value>
</context-param>
<context-param>
<param-name>org.apache.myfaces.SERIALIZE_STATE_IN_SESSION</param-name>
<param-value>false</param-value>
</context-param>
</web-app>
答案 0 :(得分:0)
org.omnifaces.filter.GzipResponseFilter。检查您的构建路径并更正设置。