我有一个运行在tomcat6上的jsf应用程序(mojarra 2.1.8,primefaces 3.3),当我用google page-speed分析firebug中的页面时,我意识到我可以通过gzip压缩来优化一些东西。
Compressing the following resources with gzip could reduce their transfer size by 371,1KiB (74% reduction).
Compressing http://localhost:8080/someApp/javax.faces.resource/jquery/jquery.js.jsf?ln=primefaces could save 72,5KiB (74% reduction).
Compressing http://localhost:8080/someApp/javax.faces.resource/theme.css.jsf?ln=primefaces-aristo could save 53,4KiB (71% reduction).
Compressing http://localhost:8080/someApp/javax.faces.resource/jsf.js.jsf?ln=javax.faces could save 49,6KiB (78% reduction).
...我已经在我的server.xml中打开了压缩
<Connector connectionTimeout="20000" port="8080" protocol="HTTP/1.1" redirectPort="8443"
compression="on"
noCompressionUserAgents="gozilla, traviata"
compressableMimeType="text/html,text/xml,text/plain,application/javascript,application/json,text/javascript"/>但它不会压缩上面列出的文件。
我还需要做些什么才能让压缩工作?
乔尼
发布于 2012-06-06 09:47:18
您的server.xml一切正常。您的具体问题很可能是您编辑了错误的server.xml文件。在像Eclipse这样的IDE中,最初的Tomcat服务器安装默认保持不变。相反,Eclipse会在Servers项目中创建其所有配置文件的副本,并使用工作空间元数据来部署webapp,最终从Tomcat安装中只使用Tomcat服务器引擎。
确保您正在编辑正确的server.xml文件,即Servers项目中的文件:

Tomcat自己的/conf/server.xml文件仅在从Eclipse外部启动时使用,或者在告诉Eclipse完全控制Tomcat安装时使用。为此,双击Servers视图中的Tomcat服务器条目,并相应地更改server位置。

https://stackoverflow.com/questions/10894779
复制相似问题