Hi Omar, I can not get it to work either, yet: >> * No content-encoding is specified by the resource >> >> I found no way to not specify an encoding for whatever I return in RESTXQ. >> If I don't specify anything it's UTF-8. it shows up as "; >> character-set=UTF-8"I did not find a way to specify no encoding. Maybe >> unrelated but perhaps that is a problem. >> >>
Content-Encoding denotes how the content has been encoded (gzip, deflate, etc.) => https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Encoding <https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Encoding> that’s not the character encoding (such as UTF8). So the GZIP handler not working correctly is most probably not due to the UTF8 Encoding you are seeing. Actually I did not get the GzipHandler working, even using the DefaultServlet ( => requests to /static) instead of BaseX’ RestXQServlet and I found this comment that states: > https://stackoverflow.com/questions/38635262/jetty-9-and-gziphandler > <https://stackoverflow.com/questions/38635262/jetty-9-and-gziphandler>The > implementation of Gzip support in Jetty is now based on a Container HTTP > Output Interceptor pattern. This means GzipHandler has to be defined at a > point in the Jetty Handler tree before your WebApp and its WebAppContext even > exists. > > I’m by no means an expert on servlets, so my conclusions might be wrong! Best Michael > Am 26.02.2019 um 18:27 schrieb Omar Siam <omar.s...@oeaw.ac.at>: > > Hi, > > I tried both ways of enabling gzip compression for JSON and js (and others). > I can't see it actually working. The GzipFilter method from the web.xml > sample seems to be deprecated with a warning of "it is bug ridden" ... But > then in a browser debugger I cannot see it actually zipping anything. > > I trief to enable this in my BaseX 9.1.2 instance using > > <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/xml,text/ecmascript,application/xhtml+xml,application/json,application/javascript,image/svg+xml</param-value> > </init-param> > </filter> > <filter-mapping> > <filter-name>GzipFilter</filter-name> > <url-pattern>/*</url-pattern> > </filter-mapping> > The GzipHandler method seems to get loaded but then also in a browser > debugger I cannot see it actually zipping anything. > > For the GzipHandler the documentation > https://www.eclipse.org/jetty/documentation/current/gzip-filter.html > <https://www.eclipse.org/jetty/documentation/current/gzip-filter.html> talks > about when it actually gets invoked and mentions: > > * No content-encoding is specified by the resource > > I found no way to not specify an encoding for whatever I return in RESTXQ. If > I don't specify anything it's UTF-8. it shows up as "; character-set=UTF-8"I > did not find a way to specify no encoding. Maybe unrelated but perhaps that > is a problem. > > I modified webapp/WEB-INF/jetty.xml like this so it uses the GzipHandler > (copied from the current jetty distribution): > > <Configure id="Server" class="org.eclipse.jetty.server.Server"> > <!-- Default connector. The Jetty stop port can be specified > in the .basex or pom.xml configuration file. --> > <Call name="addConnector"> > ... > </Call> > <Call name="insertHandler"> > <Arg> > <New id="GzipHandler" > class="org.eclipse.jetty.server.handler.gzip.GzipHandler"> > <Set name="minGzipSize"><Property name="jetty.gzip.minGzipSize" > deprecated="gzip.minGzipSize" default="2048"/></Set> > <Set name="checkGzExists"><Property name="jetty.gzip.checkGzExists" > deprecated="gzip.checkGzExists" default="false"/></Set> > <Set name="compressionLevel"><Property > name="jetty.gzip.compressionLevel" deprecated="gzip.compressionLevel" > default="-1"/></Set> > <Set name="inflateBufferSize"><Property > name="jetty.gzip.inflateBufferSize" default="0"/></Set> > <Set name="deflaterPoolCapacity"><Property > name="jetty.gzip.deflaterPoolCapacity" default="-1"/></Set> > <Set name="syncFlush"><Property name="jetty.gzip.syncFlush" > default="false" /></Set> > > <Set name="excludedAgentPatterns"> > <Array type="String"> > <Item><Property name="jetty.gzip.excludedUserAgent" > deprecated="gzip.excludedUserAgent" default=".*MSIE.6\.0.*"/></Item> > </Array> > </Set> > > <Set name="includedMethodList"><Property > name="jetty.gzip.includedMethodList" default="GET" /></Set> > <Set name="excludedMethodList"><Property > name="jetty.gzip.excludedMethodList" default="" /></Set> > > </New> > </Arg> > </Call> > </Configure> > I hope there is a way to get this to work. > > Best regards > > Omar Siam > > >