Uploaded image for project: 'Quarkus'
  1. Quarkus
  2. QUARKUS-1224

RESTEasy Reactive @NoCache unexpected behavior

XMLWordPrintable

    • False
    • False
    • +
    • Hide

      Reproducer attached.

      unzip resteasy-reactive-nocache-reproducer.zip
      cd resteasy-reactive-nocache-reproducer
      ./mvnw clean verify
      
      Show
      Reproducer attached. unzip resteasy-reactive-nocache-reproducer.zip cd resteasy-reactive-nocache-reproducer ./mvnw clean verify

      GitHub issue: https://github.com/quarkusio/quarkus/issues/19822

      When using org.jboss.resteasy.reactive.NoCache without attributes (not using the fields attribute), response headers do not contain Cache-Control: no-cache header.

      package org.acme;
      
      import javax.ws.rs.GET;
      import javax.ws.rs.Path;
      
      import org.jboss.resteasy.reactive.NoCache;
      
      @Path("/hello")
      public class NoCacheResource {
      
          @GET
          @NoCache
          public String hello() {
              return "hello";
          }
      }
      
      curl --head http://localhost:8080/hello
      
      Expected behavior

      Response:

      HTTP/1.1 200 OK
      Cache-Control: no-cache
      Content-Type: text/plain;charset=UTF-8
      
      Actual behavior

      Response:

      HTTP/1.1 200 OK
      Content-Type: text/plain;charset=UTF-8
      

      This is also inconsistent with the documentation:
      https://quarkus.io/guides/resteasy-reactive#controlling-http-caching-features

              gandrian Georgios Andrianakis
              rhn-support-jsmrcka Josef Smrcka (Inactive)
              Josef Smrcka Josef Smrcka (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated:
                Resolved: