Uploaded image for project: 'JBoss Enterprise Application Platform'
  1. JBoss Enterprise Application Platform
  2. JBEAP-13475

(7.1.z) RESTEASY-1735 - RESTEasy returns wrong Content-Encoding data if client request gzip

XMLWordPrintable

    • EAP 7.1.1

      Description:
      By default, RESTEasy returns wrong Content-Encoding data if client request gzip data and if RESTEasy end-point contains @GZiP annotation

      1. Server contains end-point with @GZIP annotation, for example this:
            @GET
            @Path("/echo")
            @GZIP
            String echo(@QueryParam("name") String message);
      2. RESTEasy client send request with "Accept-Encoding: gzip, deflate"
      3. By default, server doesn't use GZIPDecodingInterceptor, GZIPEncodingInterceptor and AcceptEncodingGZIPFilter. So server doesn't compress data
      4. server sends "Content-Encoding: gzip" in header of response, although data is not compressed

      Steps to reproduce in EAP 7.1:

      1. download attached reproducer
      2. mvn clean package -Djboss.home=${JBOSS_HOME} -Dmaven.test.failure.ignore=true

      Some technical details from same issue in master branch:
      Server returns gzip in header , because "gzip" is in "Set<String> encodings;" [4] from ServerContentEncodingAnnotationFilter class. Resteasy checks all annotations in end-point method:

      @GET
      @Path("/echo")
      @GZIP
      String echo(@QueryParam("name") String message);

      Resteasy find @GZIP annotation and check, if @GZIP annotation has @ContentEncoding annotation here [5]. GZIP annotation has @ContentEncoding, see [6]. So Resteasy return gzip in response header, although Resteasy doesn't compress data.

      [4] https://github.com/resteasy/Resteasy/blob/master/resteasy-jaxrs/src/main/java/org/jboss/resteasy/plugins/interceptors/ServerContentEncodingAnnotationFilter.java#L31
      [5] https://github.com/resteasy/Resteasy/blob/master/resteasy-jaxrs/src/main/java/org/jboss/resteasy/plugins/interceptors/ServerContentEncodingAnnotationFeature.java#L49
      [6] https://github.com/resteasy/Resteasy/blob/master/resteasy-jaxrs/src/main/java/org/jboss/resteasy/annotations/GZIP.java#L14

              pjurak Petr Jurak (Inactive)
              mkopecky@redhat.com Marek Kopecky
              Peter Mackay Peter Mackay
              Peter Mackay Peter Mackay
              Votes:
              0 Vote for this issue
              Watchers:
              9 Start watching this issue

                Created:
                Updated:
                Resolved: