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

Allow JAX-RS annotations in CDI @Stereotype

XMLWordPrintable

    • Icon: Feature Request Feature Request
    • Resolution: Won't Do
    • Icon: Major Major
    • None
    • 3.0.25.Final, 4.0.0.Beta2, 3.5.0.Final
    • CDI Integration
    • None

      A simple JAX-RS REST service can be annotated with @Produces to define the resulting mime-type. However, it is not working anymore, when the annotation is moved to a stereotype. The default application/octet-stream is used.

      @Stereotype
      @Produces(MediaType.APPLICATION_JSON)
      @Target(ElementType.TYPE)
      @Retention(RetentionPolicy.RUNTIME)
      public @interface RestService {
      }
      
      @Path("/some")
      @RestService
      public class SomeRestService {
          @GET
          @Path("/")
          public Response getSome() {
              return Response.ok().entity("{\"x\" : 42, \"y\" : \"foo\"}").build();
          }
      }
      

              pberan@redhat.com Petr Beran
              mstefank Martin Stefanko
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Created:
                Updated:
                Resolved: