You can also use the gzip init parameter to make Jetty search for compressed content. That means if the file file.txt is requested, Jetty will watch for a file named file.txt.gz and returns that.
In Jetty 8 (?) and later, you will have to use a GzipHandler as GzipFilter seems to be deprecated/missing:
<Configure class="org.eclipse.jetty.webapp.WebAppContext">
<Set name="handler">
<New class="org.eclipse.jetty.server.handler.GzipHandler"/>
<!-- package name might have changed in Jetty 9; possibly org.eclipse.jetty.server.handler.gzip.GzipHandler
as per https://stackoverflow.com/questions/35725538/jetty-gziphandler-configuration -->
</Set>
</Configure>
You have to enable the
GzipFilter
to make Jetty return compressed content. Have a look here on how to do that: http://blog.max.berger.name/2010/01/jetty-7-gzip-filter.htmlYou can also use the
gzip
init parameter to make Jetty search for compressed content. That means if the filefile.txt
is requested, Jetty will watch for a file namedfile.txt.gz
and returns that.In Jetty 8 (?) and later, you will have to use a
GzipHandler
asGzipFilter
seems to be deprecated/missing:The
gzip
init parameter still works, in case you want to only serve static content (which would in fact be more efficient than going through the GZip handler). However it is advisable to retain the uncompressed copies on the server as well, as Jetty may need to serve uncompressed content for incompatible browsers (mostly IE).