Jetty includes a gzip-filter for dynamic compression of contents, thus saving bandwidth and enabling your site to load faster (especially important if you have a lot of javascript).
To configure it, add the follwing filter definition to your web.xml:
<filter> <filter-name>GzipFilter</filter-name> <filter-class>org.eclipse.jetty.servlets.GzipFilter</filter-class> <init-param> <param-name>mimeTypes</param-name> <param-value>text/html,text/plain,text/xml,application/xhtml+xml,text/css,application/javascript,image/svg+xml</param-value> </init-param> </filter> <filter-mapping> <filter-name>GzipFilter</filter-name> <url-pattern>/*</url-pattern> </filter-mapping>
Please note: This configuration is for Jetty 7. For Jetty 6 change the filter to org.mortbay.servlet.GzipFilter.
Should this be at the root level (? Or within a servlet?
ReplyDeleteThanks!
This is set in the web.xml which you can find in the WEB-INF directory of your web application.
ReplyDeleteHi,
ReplyDeleteI do this, but only work if i compress the archive and put it togther (ie. myjs.js.gz). The server was not compress in gzip automatic.
What i have to do?
Thanks!
What can I do for Jetty 9 versions? GzipFilter is deprecated? How can I use the new GzipHandler in my configuration?
ReplyDeleteThe aquarius waterpik is a top Water Flosser Reviews rated flosser amongst users for its performances read more when it comes flossing need.
ReplyDeleteAre you sure this filter works?
ReplyDeletehttp://cc.forum.igg.com/topic?ctid=278782&t=1550297283
https://www.badlogicgames.com/forum/viewtopic.php?f=22&t=26575&p=112787
https://www.yelloyello.com/places/crunchtime-software
https://www.keyshot.com/forum/index.php?topic=21980.0
http://hawer.siteboard.eu/t10949f2001-and-fully-wh.html