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 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