我计划在我的应用程序上使用omnifaces,它通过网络传输大量数据。我已经配置了web.xml文件,如下面的omnifaces展示中提到的那样
<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 500.
</description>
<param-name>threshold</param-name>
<param-value>500</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/javascript, application/json
</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>gzipResponseFilter</filter-name>
<url-pattern>/*</url-pattern>
<dispatcher>REQUEST</dispatcher>
<dispatcher>ERROR</dispatcher>
</filter-mapping>
我正在使用 curl 来测试大小,但我没有注意到任何显着差异。 没有 gzip 配置
curl http://localhost:8080/omnifaces-test/ > t
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 1666 100 1666 0 0 126k 0 --:--:-- --:--:-- --:--:-- 147k
使用 gzip 配置
curl http://localhost:8080/omnifaces-test/ > t
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 1666 100 1666 0 0 283k 0 --:--:-- --:--:-- --:--:-- 406k
你能告诉我为什么我在上面两个命令之间没有任何区别吗?