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

CrossOriginResourceSharing annotation on a super interface is not interpreted

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 3.1.14
    • Fix Version/s: 3.2.2, 3.1.15
    • Component/s: JAX-RS Security
    • Labels:
      None
    • Estimated Complexity:
      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

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

              Dates

              • Created:
                Updated:
                Resolved: