Tools and Technologies used in this article :

  1. Jetty 8

  2. Java Web Application

Note : Prior to Jetty 7, all versions were hosted in, 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.xml
Use 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