Uploaded image for project: 'RESTEasy'
  1. RESTEasy
  2. RESTEASY-692

Invalid Content-Length sent for method annotated with @GZIP and returning a byte array

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • 2.3.3.Final
    • 2.3.2.Final, 2.3.1
    • jaxrs
    • None

      For the example below, if the method is invoked with Accept-Encoding:gzip, then the value of Content-Length sent back is 11 (which is the length of "Hello World" uncompressed).

      @Path("reports")
      class Test {
          @GET
          @GZIP
          Response helloWorld() {
              try {
                  return Response.ok("Hello World".getBytes("ISO-8859-1")).type(MediaType.TEXT_PLAIN).build();
              }
              catch (UnsupportedEncodingException e) {
                  throw new AssertionError(e);
              }
          }
      }
      

      If the entity were a String, then the value of Content-Length sent is correct (31).

      @Path("reports")
      class Test {
          @GET
          @GZIP
          Response helloWorld() {
              return Response.ok("Hello World").type(MediaType.TEXT_PLAIN).build();
          }
      }
      

              patriot1burke@gmail.com Bill Burke (Inactive)
              clovis.seragiotto Clovis Seragiotto (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Created:
                Updated:
                Resolved: