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).
...
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?
Jonny
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.
Make sure that you're editing the right server.xml
file, the one in Servers project:
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With