I am trying to enable gzip compression on Jetty 9. I do not want to configure it in my web.xml, so based on the Jetty documentation I have configured override-web.xml. I do not use Jetty in native mode, but as a container.
In my {jetty.home}/webapps , I have a war file - cc.war. I also defined cc.xml as follows
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "http://www.eclipse.org/jetty/configure_9_0.dtd"> <Configure class="org.eclipse.jetty.webapp.WebAppContext"> <Set name="contextPath">/</Set> <Set name="war"><Property name="jetty.webapps"/>/cc.war</Set> <Set name="overrideDescriptor"><Property name="jetty.webapps" default="."/>/cc.d/override-web.xml</Set> </Configure>
In the cc.d folder, I have override-web.xml as follows:
<?xml version="1.0" encoding="UTF-8"?> <web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_2_5.xsd" version="2.5"> <filter> <filter-name>GzipFilter</filter-name> <filter-class>org.eclipse.jetty.servlets.GzipFilter</filter-class> <init-param> <param-name>methods</param-name> <param-value>GET,POST</param-value> </init-param> <init-param> <param-name>mimeTypes</param-name> <param-value>text/html,text/xml,text/plain,text/css,text/javascript,text/json,application/x-javascript,application/javascript,application/json,application/xml,application/xml+xhtml,image/svg+xml</param-value> </init-param> </filter> <filter-mapping> <filter-name>GzipFilter</filter-name> <url-pattern>/*</url-pattern> </filter-mapping> </web-app>
Jetty seems to load this penalty, but gzip compression does not apply to any of the answers. I say that Jetty downloaded this penalty because earlier, when I tried to place override-web.xml in the webapps folder, Jetty complained.
I covered various questions here on SO, but none of them seemed to answer that. Any help is appreciated.
source share