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

SSE doesn't work with inherited annotations

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Critical Critical
    • 3.12.0.Final, 4.5.5.Final
    • 4.0.0.Beta5, 3.6.3.Final, 4.0.0.CR2
    • jaxrs
    • None
    • Hide

      Using a setup like below...

      interface API {
      
        @Produces("text/event-stream")
        @GET
        @Path("events")
        void events(@Context SseEventSink sseSink, @Context Sse sse);
      
      }
      
      class APIImpl implements API {
        void events(SseEventSink sseSink, Sse sse) {
          active.saveForLater(sseSink, sse);
        }
      }
      
      

      The error seems to be located at SseEventOutputImpl.java:116. It uses method.getMethod().getAnnotation(). Which doesn't look for inherited annotations.

      The fix appears simple. "method" which is a "ResourceMethodInvoker" already has all the inherited annotations gathered. It just needs to be checked in place of the current.

      Show
      Using a setup like below... interface API { @Produces( "text/event-stream" ) @GET @Path( "events" ) void events(@Context SseEventSink sseSink, @Context Sse sse); } class APIImpl implements API { void events(SseEventSink sseSink, Sse sse) { active.saveForLater(sseSink, sse); } } The error seems to be located at SseEventOutputImpl.java:116. It uses method.getMethod().getAnnotation(). Which doesn't look for inherited annotations. The fix appears simple. "method" which is a "ResourceMethodInvoker" already has all the inherited annotations gathered. It just needs to be checked in place of the current.

      When defining JAX-RS methods via an interface the framework incorrectly reports that the method is missing annotations. The exact message is:

      Expected @Stream or @Produces("text/event-stream")
      

            rhn-engineering-ema Jim Ma
            kevinwooten Kevin Wooten (Inactive)
            Votes:
            1 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: