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

Sse can't server for a get url without "Accept: text/event-stream" header

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • Major
    • 4.0.0.Beta1, 3.5.0.CR1
    • 3.1.4.Final
    • jaxrs
    • None

    Description

      Rostislav found this doesn't work in Resteasy:

      Hi.
      I played a bit with SSE, example based on https://www.youtube.com/watch?time_continue=8&v=qQLVCgmiMgQ
      Code is here https://github.com/rsvoboda/rsvoboda-playground/tree/master/ee8-sample-sse

      For GlassFish 5 I could do just: curl -i http://localhost:8080/ee8-sample-sse/resources/beats

      But for WF I had to specify Accept header: curl -i -H "Accept: text/event-stream" http://localhost:8080/ee8-sample-sse/resources/beats
      When I used curl command which was working on GlassFish 5 I received pretty nasty NPE stacktrace.

      These days people are playing quite a lot with new stuff in EE8, they are using GlassFish 5 and composing their clients (Java, JavaScript, curl / libcurl ) based on this experience (who reads the spec ? when you have RI you can trust ).
      RESTEasy requirement on Accept header can be pain you_know_where for migration towards JBoss world.

      For sure the error message should be more user friendly and more descriptive.
      And I would also vote for more RI like behavior in this case. WDYT ?

      NPE details:
      Error processing request
      Context Path:
      /ee8-sample

      Servlet Path:
      /resources

      Path Info:
      /beats

      Query String:
      null

      Stack Trace
      org.jboss.resteasy.spi.UnhandledException: javax.ejb.EJBException: java.lang.NullPointerException
      org.jboss.resteasy.core.ExceptionHandler.handleApplicationException(ExceptionHandler.java:78)
      org.jboss.resteasy.core.ExceptionHandler.handleException(ExceptionHandler.java:222)
      org.jboss.resteasy.core.SynchronousDispatcher.writeException(SynchronousDispatcher.java:183)
      org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:444)
      org.jboss.resteasy.core.SynchronousDispatcher.lambda$invoke$1(SynchronousDispatcher.java:219)
      org.jboss.resteasy.core.SynchronousDispatcher.lambda$preprocess$0(SynchronousDispatcher.java:132)
      org.jboss.resteasy.core.interception.jaxrs.PreMatchContainerRequestContext.filter(PreMatchContainerRequestContext.java:367)
      org.jboss.resteasy.core.SynchronousDispatcher.preprocess(SynchronousDispatcher.java:135)
      org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:205)
      org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.service(ServletContainerDispatcher.java:227)
      org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:56)
      org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:51)
      javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
      io.undertow.servlet.handlers.ServletHandler.handleRequest(ServletHandler.java:85)
      io.undertow.servlet.handlers.security.ServletSecurityRoleHandler.handleRequest(ServletSecurityRoleHandler.java:62)
      io.undertow.servlet.handlers.ServletDispatchingHandler.handleRequest(ServletDispatchingHandler.java:36)
      org.wildfly.extension.undertow.security.SecurityContextAssociationHandler.handleRequest(SecurityContextAssociationHandler.java:78)
      io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
      io.undertow.servlet.handlers.security.SSLInformationAssociationHandler.handleRequest(SSLInformationAssociationHandler.java:131)
      io.undertow.servlet.handlers.security.ServletAuthenticationCallHandler.handleRequest(ServletAuthenticationCallHandler.java:57)
      io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
      io.undertow.security.handlers.AbstractConfidentialityHandler.handleRequest(AbstractConfidentialityHandler.java:46)
      io.undertow.servlet.handlers.security.ServletConfidentialityConstraintHandler.handleRequest(ServletConfidentialityConstraintHandler.java:64)
      io.undertow.security.handlers.AuthenticationMechanismsHandler.handleRequest(AuthenticationMechanismsHandler.java:60)
      io.undertow.servlet.handlers.security.CachedAuthenticatedSessionHandler.handleRequest(CachedAuthenticatedSessionHandler.java:77)
      io.undertow.security.handlers.NotificationReceiverHandler.handleRequest(NotificationReceiverHandler.java:50)
      io.undertow.security.handlers.AbstractSecurityContextAssociationHandler.handleRequest(AbstractSecurityContextAssociationHandler.java:43)
      io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
      org.wildfly.extension.undertow.security.jacc.JACCContextIdHandler.handleRequest(JACCContextIdHandler.java:61)
      io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
      io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
      io.undertow.servlet.handlers.ServletInitialHandler.handleFirstRequest(ServletInitialHandler.java:292)
      io.undertow.servlet.handlers.ServletInitialHandler.access$100(ServletInitialHandler.java:81)
      io.undertow.servlet.handlers.ServletInitialHandler$2.call(ServletInitialHandler.java:138)
      io.undertow.servlet.handlers.ServletInitialHandler$2.call(ServletInitialHandler.java:135)
      io.undertow.servlet.core.ServletRequestContextThreadSetupAction$1.call(ServletRequestContextThreadSetupAction.java:48)
      io.undertow.servlet.core.ContextClassLoaderSetupAction$1.call(ContextClassLoaderSetupAction.java:43)
      io.undertow.servlet.api.LegacyThreadSetupActionWrapper$1.call(LegacyThreadSetupActionWrapper.java:44)
      io.undertow.servlet.api.LegacyThreadSetupActionWrapper$1.call(LegacyThreadSetupActionWrapper.java:44)
      io.undertow.servlet.api.LegacyThreadSetupActionWrapper$1.call(LegacyThreadSetupActionWrapper.java:44)
      io.undertow.servlet.api.LegacyThreadSetupActionWrapper$1.call(LegacyThreadSetupActionWrapper.java:44)
      io.undertow.servlet.api.LegacyThreadSetupActionWrapper$1.call(LegacyThreadSetupActionWrapper.java:44)
      io.undertow.servlet.handlers.ServletInitialHandler.dispatchRequest(ServletInitialHandler.java:272)
      io.undertow.servlet.handlers.ServletInitialHandler.access$000(ServletInitialHandler.java:81)
      io.undertow.servlet.handlers.ServletInitialHandler$1.handleRequest(ServletInitialHandler.java:104)
      io.undertow.server.Connectors.executeRootHandler(Connectors.java:202)
      io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.java:805)
      java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
      java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
      java.lang.Thread.run(Thread.java:748)

      Attachments

        Issue Links

          Activity

            People

              rhn-engineering-ema Jim Ma
              rhn-engineering-ema Jim Ma
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: