用于jsf的gzip压缩 [英] gzip compression for jsf stuff

查看:94
本文介绍了用于jsf的gzip压缩的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在tomcat 6上运行了一个jsf应用程序(mojarra 2.1.8,primefaces 3.3).在使用Google页面速​​度分析Firebug中的页面时,我意识到我可以通过gzip-compression优化某些内容.

I have an jsf application (mojarra 2.1.8, primefaces 3.3) running on tomcat 6. While analyzing the page in firebug with google page-speed, I realized I could optimize some stuff by gzip-compression.

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中打开了压缩

I already turned on compression in my 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"/>

但是它不会压缩上面提到的文件.

But it doesn't compress the mentioned files listed above.

要使压缩正常工作,我还需要做什么?

What else do I have to do to get compression working?

强尼

推荐答案

您的server.xml很好.您的具体问题很可能是您编辑了错误的server.xml文件.在像Eclipse这样的IDE中,默认情况下不更改原始Tomcat服务器的安装.取而代之的是,Eclipse在 Servers 项目中创建其所有配置文件的副本,并使用工作空间元数据来部署Web应用程序,最终仅从Tomcat安装中使用了Tomcat服务器引擎.

Your server.xml is all fine. Your concrete problem is most likely that you've edited the wrong server.xml file. In an IDE like Eclipse, the original Tomcat server installation is by default kept untouched. Instead, Eclipse creates a copy of all its configuration files in the Servers project and uses the workspace metadata to deploy the webapps and ultimately only the Tomcat server engine is been used from the Tomcat installation.

确保您正在编辑正确的server.xml文件,即 Servers 项目中的文件:

Make sure that you're editing the right server.xml file, the one in Servers project:

Tomcat自己的/conf/server.xml文件仅在您在Eclipse外部启动时使用,或者当您告诉Eclipse完全控制Tomcat的安装时才使用.要做到这一点, 在 Servers 视图中双击Tomcat服务器条目,并相应地更改 Server Locations .

Tomcat's own /conf/server.xml file is only used when you start it outside Eclipse, or when you tell Eclipse to take full control over Tomcat installation instead. To do that, doubleclick the Tomcat server entry in Servers view and alter the Server Locations accordingly.

这篇关于用于jsf的gzip压缩的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆