Reputation: 19066
I have finished development of a Java EE web application
Under Eclipse IDE and Tomcat v6.0 as a localhost Server
Now I need to make my localhost Server (Tomcat v6.0) Enable compression "gzip"
For static resources as (JavaScript files, CSS files , Images , ...)
Upvotes: 4
Views: 6939
Reputation: 5619
If you want to gzip js and css files than Iswanto San's answer is correct.
If you want to gzip html pages then the following configuration should help.
compression="on"
compressionMinSize="2048"
compressableMimeType="text/html,text/xml"
If you want to gzip all response
compressableMimeType="text/html, text/xml,text/plain,text/javascript,text/css"
Upvotes: 5
Reputation: 18569
Open /conf/server.xml,
add this configuration in your HTTP connector:
compression="on"
compressionMinSize="2048"
compressableMimeType="application/javascript, text/css"
For example:
<Connector port="8080" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8443"
compression="on"
compressionMinSize="2048"
compressableMimeType="application/javascript, text/css"/>
More Apache Tomcat HTTP
Upvotes: 10