Uploaded image for project: 'CXF'
  1. CXF
  2. CXF-7561

CrossOriginResourceSharing annotation on a super interface is not interpreted

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 3.1.14
    • 3.2.2, 3.1.15
    • JAX-RS Security
    • None
    • Novice

    Description

      Hi,

      I have multiple endpoints and I would like to apply the same CORS configuration for all services.
      What I've done is to create a root interface like this:

      @CrossOriginResourceSharing(
              allowAllOrigins = true,
              allowCredentials = true,
              maxAge = 1209600,
              allowHeaders = {"X-HTTP-Method-Override"},
              exposeHeaders = {"X-Total-Count"}
      )
      public interface CorsEnabledService {
      }
      

      and then I've extended on all my actual services this interface:

      @Path("/example1")
      public interface ExampleService extends CorsEnabledService {
      
          @GET
          @Path("/")
          @Produces({MediaType.APPLICATION_JSON})
          Response getResults();
      }
      
      @Path("/example2")
      public interface SecondExampleService extends CorsEnabledService {
      
          @GET
          @Path("/")
          @Produces({MediaType.APPLICATION_JSON})
          Response getSecondResults();
      }
      

      This is not working and I have to duplicate the cors related annotation everywhere.
      Isn't this supposed to work? It will be awesome to have it working.

      I see this as a bug since defining common annotations is quite a common practice and I would expect this to work.

      Attachments

        Activity

          People

            sergey_beryozkin Sergey Beryozkin
            micleva Valer Micle
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: