Log In | Sign Up   View a printable version of the current page.
  Dashboard > [fleXive] > ... > How-Tos > Use GZIP compression

Added by Daniel Lichtenberger, last edited by Daniel Lichtenberger on Feb 26, 2010  (view change)
Labels: 
(None)

Using GZIP compression

GZIP compression greatly reduces the bandwidth needed for loading HTML pages and text resources like JavaScript files and CSS stylesheets. [fleXive] does not come with its own GZIP filter, since this service is often provided by the application server.

Enabling GZIP compression on JBoss 4.2

  • Open [JBoss-Home]/server/default/deploy/jboss-web.deployer/server.xml
  • Add the following attributes to the Connector element for your HTTP port (usually 8080):
    compression="on"
    compressableMimeType="text/html,text/xml,text/plain,text/css,text/javascript,application/x-javascript"
  • Your connector element should look similar to this now:
    <Connector port="8080" address="${jboss.bind.address}"    
             maxThreads="250" maxHttpHeaderSize="8192"
             emptySessionPath="true" protocol="HTTP/1.1"
             enableLookups="false" redirectPort="8443" acceptCount="100"
             connectionTimeout="20000" disableUploadTimeout="true"
             compression="on" 
             compressableMimeType="text/html,text/xml,text/plain,text/css,text/javascript,application/x-javascript"/>

Enabling GZIP compression on Glassfish 2

  • Open the Glassfish administration console (http://localhost:4848/)
  • Open Configuration > HTTP Service > HTTP Listeners
  • Select the listener for the desired port (e.g. http-listener-1)
  • Add the following properties on the bottom of the page:
    • compression=on
    • compressableMimeType=text/html,text/xml,text/plain,text/css,text/javascript,application/json
  • Now all the responses should be encoded using GZIP. You can check this using a tool like Firebug for Firefox or any other HTTP header viewer.
Site running on a free Atlassian Confluence Open Source Project License granted to [fleXive] . Evaluate Confluence today.
Powered by Atlassian Confluence, the Enterprise Wiki. (Version: 2.6.1 Build:#916 Nov 09, 2007) - Bug/feature request - Contact Administrators