Configure GZIP Filter on Jetty 8 for dynamic compression of contents
2,683 views
By Abhijit Ghosh on Sep 10, 2012 2:16:51 AM
Jetty provides Gzip Filter to enable dynamic compression of contents like html, javascript, css etc. Just a servlet filter 'org.eclipse.jetty.servlets.GzipFilter' needs to be configured in web.xml to save bandwidth and speed up your website.
Tools and Technologies used in this article :
Jetty 8
Java Web Application
Note : Prior to Jetty 7, all versions were hosted in jetty.codehaus.org, so refer that site to get the correct package name of GzipFilter class. For example, In Jetty 6 we need to use org.mortbay.servlet.GzipFilter.
Download :
Update web.xml
Add GzipFilter in the 'web.xml' file of your web application to be deployed in Jetty server.
File : web.xmlUse comma separated mimeTypes for which you want Jetty to apply GZIP compression.
Note : Don't use gzip compression for image (except SVG), video, PDF or other binary files. These are already compressed, so you will not get any additional benefit out of it. .
Download Source Code
SrcCodes : web.xml