Did you try to add the GzipFilter ? You can register the GzipFilter as a Filter service (using the http whiteboard pattern), providing mimeTypes and url-patterns as service properties.
Regards JB On 18/04/2019 13:17, Markus Rathgeb wrote: > To be clear: > My whole setup is currently working WITHOUT the gzip compression > (GzipHandler). > I just want to know what I need to do to add Jetty's GzipHandler to > programmatically registered servlets and to static content that is > currently already added by the jetty.xml. > > Am Do., 18. Apr. 2019 um 12:33 Uhr schrieb Jean-Baptiste Onofré > <j...@nanthrax.net>: >> >> Hi Markus, >> >> Are you using jetty.xml in config property from org.ops4j.pax.web.cfg ? >> Else your configuration won't be loaded in the Karaf Jetty connector. >> >> Regards >> JB >> >> On 18/04/2019 11:36, Markus Rathgeb wrote: >>> Hi, >>> >>> I would like to use gzip compression for >>> * my servlets registered using the "registerServlet" method of "HttpService" >>> * for a handler that provides static content of a directory added by >>> jetty.xml >>> >>> The programmatic registered servlets are the most important ones. >>> Would be nice if there is one global option to configure the default >>> behavior and if it is still configurable per servlet. >>> >>> For the static content I am currently using that part of the jetty.xml >>> === >>> <Get name="handler"> >>> <Call name="addHandler"> >>> <Arg> >>> <New class="org.eclipse.jetty.server.handler.ContextHandler"> >>> <Set name="contextPath">/foo/static</Set> >>> <Set name="handler"> >>> <New class="org.eclipse.jetty.server.handler.ResourceHandler"> >>> <Set name="resourceBase"><SystemProperty >>> name="http.base.conf" />/html-foo</Set> >>> <Set name="directoriesListed">false</Set> >>> </New> >>> </Set> >>> </New> >>> </Arg> >>> </Call> >>> <Call name="addHandler"> >>> <Arg> >>> <New class="org.eclipse.jetty.servlet.ServletContextHandler"> >>> <Set name="contextPath">/bar/static</Set> >>> <Set name="resourceBase"><SystemProperty >>> name="http.base.conf" />/html-bar</Set> >>> <Call name="addServlet"> >>> <Arg>org.eclipse.jetty.servlet.DefaultServlet</Arg> >>> <Arg>/</Arg> >>> <Call name="setInitParameter"> >>> <Arg>dirAllowed</Arg> >>> <Arg>false</Arg> >>> </Call> >>> </Call> >>> </New> >>> </Arg> >>> </Call> >>> </Get> >>> === >>> >>> Can you give me some tips / information / solution? >>> >>> Best regards, >>> Markus >>> >> >> -- >> Jean-Baptiste Onofré >> jbono...@apache.org >> http://blog.nanthrax.net >> Talend - http://www.talend.com -- Jean-Baptiste Onofré jbono...@apache.org http://blog.nanthrax.net Talend - http://www.talend.com