Omnifaces Gzip压缩不会压缩,尽管接受编码:gzip,deflate set

时间:2015-05-11 06:22:15

标签: jsf-2 primefaces gzip omnifaces

我正在使用Omnifaces 1.7 / primefaces 5.2 / jsf 2.0 / J2ee 5 / weblogic 10.3 / IE 11。

我已经设置了GzipResponseFilter来为我的webapp启用压缩。尽管添加了以下配置,但我没有看到浏览器中收到的响应大小有任何差异。我正在使用IE11及其调试工具来检查响应大小。我还看到Accept-Encoding - gzip,deflat - 在IE11的请求头中传递。任何人都可以帮助我知道为什么我看不到压缩工作。下面是web.xml?

<filter>
    <filter-name>gzipResponseFilter</filter-name>
    <filter-class>org.omnifaces.filter.GzipResponseFilter</filter-class>
    <init-param>
        <param-name>threshold</param-name>
        <param-value>150</param-value> <!-- size larger than 150 should be compressed -->
    </init-param>
    <init-param>
        <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/javascript, application/json
        </param-value>
    </init-param>
</filter>
<filter-mapping>
    <filter-name>gzipResponseFilter</filter-name>
    <servlet-name>Faces Servlet</servlet-name>
    <dispatcher>REQUEST</dispatcher>
    <dispatcher>ERROR</dispatcher>
</filter-mapping>

1 个答案:

答案 0 :(得分:0)

尝试使用不同的网址格式

<filter-mapping>
    <filter-name>gzipResponseFilter</filter-name>
    <url-pattern>/*</url-pattern>
    <dispatcher>REQUEST</dispatcher>
    <dispatcher>ERROR</dispatcher>
</filter-mapping>

有关我如何执行此操作的详细信息,请参阅以下链接 https://stackoverflow.com/a/35567295/5076414