gpt4 book ai didi

tomcat - jsf 东西的 gzip 压缩

转载 作者:行者123 更新时间:2023-11-28 21:47:09 26 4
gpt4 key购买 nike

我有一个在 tomcat 6 上运行的 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"/>

但它不会压缩上面列出的文件。

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

强尼

最佳答案

您的server.xml 一切正常。您的具体问题很可能是您编辑了错误的 server.xml 文件。在像 Eclipse 这样的 IDE 中,默认情况下原始 Tomcat 服务器安装保持不变。相反,Eclipse 在 Servers 项目中创建其所有配置文件的副本,并使用工作区元数据部署 Web 应用程序,最终只使用 Tomcat 安装中的 Tomcat 服务器引擎。

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

enter image description here

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

enter image description here

关于tomcat - jsf 东西的 gzip 压缩,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10894779/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com