<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<div class="moz-cite-prefix">Sure. Alessio. I already filed a jira
for this : <a class="moz-txt-link-freetext" href="https://issues.jboss.org/browse/RESTEASY-1733">https://issues.jboss.org/browse/RESTEASY-1733</a><br>
Will back to look at this later. Thanks for reporting this,
Rostislav. <br>
<br>
Cheers,<br>
JIm<br>
On 10/11/2017 09:56 PM, Alessio Soldano wrote:<br>
</div>
<blockquote type="cite"
cite="mid:CAKQecn88Bphq3k5wZq_h7KgC_GYj0hGijF2LiYbXOoM2U=63cw@mail.gmail.com">
<div dir="ltr">
<div>
<div>
<div>
<div>
<div>Thanks Rostislav.<br>
</div>
We've been mentioning this briefly with Jim on IRC this
morning. It looks like a bug in the way SSE is turned on
on server side as a consequence of the specified
acceptable media types, which clearly come from the
accept header in the request.<br>
</div>
So, I've performed a preliminary analysis, I think the
SseEventSinkInterceptor should avoid relying on the
acceptable media types; instead it should be going through
the container request context (which should be a
PostMatchRequestContext instance in that case, given
there's no @PreMatching annotation), extract the
ResourceMethodInvoker instance from that and finally get
access to the corresponding matched resource method/class.
Those would then be used to look for <span
class="gmail-pl-k">@Produces</span>(<span
class="gmail-pl-smi">MediaType</span><span
class="gmail-pl-c1"><span class="gmail-pl-k">.</span>SERVER_SENT_EVENTS</span>)
and enable SSE.<br>
</div>
Jim, can you work on this please?<br>
</div>
Thanks<br>
</div>
Alessio<br>
</div>
<div class="gmail_extra"><br>
<div class="gmail_quote">On Wed, Oct 11, 2017 at 10:26 AM,
Rostislav Svoboda <span dir="ltr"><<a
href="mailto:rsvoboda@redhat.com" target="_blank"
moz-do-not-send="true">rsvoboda@redhat.com</a>></span>
wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0
.8ex;border-left:1px #ccc solid;padding-left:1ex">Hi.<br>
<br>
I played a bit with SSE, example based on <a
href="https://www.youtube.com/watch?time_continue=8&v=qQLVCgmiMgQ"
rel="noreferrer" target="_blank" moz-do-not-send="true">https://www.youtube.com/watch?<wbr>time_continue=8&v=qQLVCgmiMgQ</a><br>
Code is here <a
href="https://github.com/rsvoboda/rsvoboda-playground/tree/master/ee8-sample-sse"
rel="noreferrer" target="_blank" moz-do-not-send="true">https://github.com/rsvoboda/<wbr>rsvoboda-playground/tree/<wbr>master/ee8-sample-sse</a><br>
<br>
For GlassFish 5 I could do just: curl -i <a
href="http://localhost:8080/ee8-sample-sse/resources/beats"
rel="noreferrer" target="_blank" moz-do-not-send="true">http://localhost:8080/ee8-<wbr>sample-sse/resources/beats</a><br>
<br>
But for WF I had to specify Accept header: curl -i -H
"Accept: text/event-stream" <a
href="http://localhost:8080/ee8-sample-sse/resources/beats"
rel="noreferrer" target="_blank" moz-do-not-send="true">http://localhost:8080/ee8-<wbr>sample-sse/resources/beats</a><br>
When I used curl command which was working on GlassFish 5 I
received pretty nasty NPE stacktrace.<br>
<br>
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;) ).<br>
RESTEasy requirement on Accept header can be pain
you_know_where for migration towards JBoss world.<br>
<br>
For sure the error message should be more user friendly and
more descriptive.<br>
And I would also vote for more RI like behavior in this
case. WDYT ?<br>
<br>
<br>
NPE details:<br>
Error processing request<br>
Context Path:<br>
/ee8-sample<br>
<br>
Servlet Path:<br>
/resources<br>
<br>
Path Info:<br>
/beats<br>
<br>
Query String:<br>
null<br>
<br>
Stack Trace<br>
org.jboss.resteasy.spi.<wbr>UnhandledException:
javax.ejb.EJBException: java.lang.NullPointerException<br>
org.jboss.resteasy.core.<wbr>ExceptionHandler.<wbr>handleApplicationException(<wbr>ExceptionHandler.java:78)<br>
org.jboss.resteasy.core.<wbr>ExceptionHandler.<wbr>handleException(<wbr>ExceptionHandler.java:222)<br>
org.jboss.resteasy.core.<wbr>SynchronousDispatcher.<wbr>writeException(<wbr>SynchronousDispatcher.java:<wbr>183)<br>
org.jboss.resteasy.core.<wbr>SynchronousDispatcher.invoke(<wbr>SynchronousDispatcher.java:<wbr>444)<br>
org.jboss.resteasy.core.<wbr>SynchronousDispatcher.lambda$<wbr>invoke$1(<wbr>SynchronousDispatcher.java:<wbr>219)<br>
org.jboss.resteasy.core.<wbr>SynchronousDispatcher.lambda$<wbr>preprocess$0(<wbr>SynchronousDispatcher.java:<wbr>132)<br>
org.jboss.resteasy.core.<wbr>interception.jaxrs.<wbr>PreMatchContainerRequestContex<wbr>t.filter(<wbr>PreMatchContainerRequestContex<wbr>t.java:367)<br>
org.jboss.resteasy.core.<wbr>SynchronousDispatcher.<wbr>preprocess(<wbr>SynchronousDispatcher.java:<wbr>135)<br>
org.jboss.resteasy.core.<wbr>SynchronousDispatcher.invoke(<wbr>SynchronousDispatcher.java:<wbr>205)<br>
org.jboss.resteasy.plugins.<wbr>server.servlet.<wbr>ServletContainerDispatcher.<wbr>service(<wbr>ServletContainerDispatcher.<wbr>java:227)<br>
org.jboss.resteasy.plugins.<wbr>server.servlet.<wbr>HttpServletDispatcher.service(<wbr>HttpServletDispatcher.java:56)<br>
org.jboss.resteasy.plugins.<wbr>server.servlet.<wbr>HttpServletDispatcher.service(<wbr>HttpServletDispatcher.java:51)<br>
javax.servlet.http.<wbr>HttpServlet.service(<wbr>HttpServlet.java:790)<br>
io.undertow.servlet.handlers.<wbr>ServletHandler.handleRequest(<wbr>ServletHandler.java:85)<br>
io.undertow.servlet.handlers.<wbr>security.<wbr>ServletSecurityRoleHandler.<wbr>handleRequest(<wbr>ServletSecurityRoleHandler.<wbr>java:62)<br>
io.undertow.servlet.handlers.<wbr>ServletDispatchingHandler.<wbr>handleRequest(<wbr>ServletDispatchingHandler.<wbr>java:36)<br>
org.wildfly.extension.<wbr>undertow.security.<wbr>SecurityContextAssociationHand<wbr>ler.handleRequest(<wbr>SecurityContextAssociationHand<wbr>ler.java:78)<br>
io.undertow.server.handlers.<wbr>PredicateHandler.<wbr>handleRequest(<wbr>PredicateHandler.java:43)<br>
io.undertow.servlet.handlers.<wbr>security.<wbr>SSLInformationAssociationHandl<wbr>er.handleRequest(<wbr>SSLInformationAssociationHandl<wbr>er.java:131)<br>
io.undertow.servlet.handlers.<wbr>security.<wbr>ServletAuthenticationCallHandl<wbr>er.handleRequest(<wbr>ServletAuthenticationCallHandl<wbr>er.java:57)<br>
io.undertow.server.handlers.<wbr>PredicateHandler.<wbr>handleRequest(<wbr>PredicateHandler.java:43)<br>
io.undertow.security.handlers.<wbr>AbstractConfidentialityHandler<wbr>.handleRequest(<wbr>AbstractConfidentialityHandler<wbr>.java:46)<br>
io.undertow.servlet.handlers.<wbr>security.<wbr>ServletConfidentialityConstrai<wbr>ntHandler.handleRequest(<wbr>ServletConfidentialityConstrai<wbr>ntHandler.java:64)<br>
io.undertow.security.handlers.<wbr>AuthenticationMechanismsHandle<wbr>r.handleRequest(<wbr>AuthenticationMechanismsHandle<wbr>r.java:60)<br>
io.undertow.servlet.handlers.<wbr>security.<wbr>CachedAuthenticatedSessionHand<wbr>ler.handleRequest(<wbr>CachedAuthenticatedSessionHand<wbr>ler.java:77)<br>
io.undertow.security.handlers.<wbr>NotificationReceiverHandler.<wbr>handleRequest(<wbr>NotificationReceiverHandler.<wbr>java:50)<br>
io.undertow.security.handlers.<wbr>AbstractSecurityContextAssocia<wbr>tionHandler.handleRequest(<wbr>AbstractSecurityContextAssocia<wbr>tionHandler.java:43)<br>
io.undertow.server.handlers.<wbr>PredicateHandler.<wbr>handleRequest(<wbr>PredicateHandler.java:43)<br>
org.wildfly.extension.<wbr>undertow.security.jacc.<wbr>JACCContextIdHandler.<wbr>handleRequest(<wbr>JACCContextIdHandler.java:61)<br>
io.undertow.server.handlers.<wbr>PredicateHandler.<wbr>handleRequest(<wbr>PredicateHandler.java:43)<br>
io.undertow.server.handlers.<wbr>PredicateHandler.<wbr>handleRequest(<wbr>PredicateHandler.java:43)<br>
io.undertow.servlet.handlers.<wbr>ServletInitialHandler.<wbr>handleFirstRequest(<wbr>ServletInitialHandler.java:<wbr>292)<br>
io.undertow.servlet.handlers.<wbr>ServletInitialHandler.access$<wbr>100(ServletInitialHandler.<wbr>java:81)<br>
io.undertow.servlet.handlers.<wbr>ServletInitialHandler$2.call(<wbr>ServletInitialHandler.java:<wbr>138)<br>
io.undertow.servlet.handlers.<wbr>ServletInitialHandler$2.call(<wbr>ServletInitialHandler.java:<wbr>135)<br>
io.undertow.servlet.core.<wbr>ServletRequestContextThreadSet<wbr>upAction$1.call(<wbr>ServletRequestContextThreadSet<wbr>upAction.java:48)<br>
io.undertow.servlet.core.<wbr>ContextClassLoaderSetupAction$<wbr>1.call(<wbr>ContextClassLoaderSetupAction.<wbr>java:43)<br>
io.undertow.servlet.api.<wbr>LegacyThreadSetupActionWrapper<wbr>$1.call(<wbr>LegacyThreadSetupActionWrapper<wbr>.java:44)<br>
io.undertow.servlet.api.<wbr>LegacyThreadSetupActionWrapper<wbr>$1.call(<wbr>LegacyThreadSetupActionWrapper<wbr>.java:44)<br>
io.undertow.servlet.api.<wbr>LegacyThreadSetupActionWrapper<wbr>$1.call(<wbr>LegacyThreadSetupActionWrapper<wbr>.java:44)<br>
io.undertow.servlet.api.<wbr>LegacyThreadSetupActionWrapper<wbr>$1.call(<wbr>LegacyThreadSetupActionWrapper<wbr>.java:44)<br>
io.undertow.servlet.api.<wbr>LegacyThreadSetupActionWrapper<wbr>$1.call(<wbr>LegacyThreadSetupActionWrapper<wbr>.java:44)<br>
io.undertow.servlet.handlers.<wbr>ServletInitialHandler.<wbr>dispatchRequest(<wbr>ServletInitialHandler.java:<wbr>272)<br>
io.undertow.servlet.handlers.<wbr>ServletInitialHandler.access$<wbr>000(ServletInitialHandler.<wbr>java:81)<br>
io.undertow.servlet.handlers.<wbr>ServletInitialHandler$1.<wbr>handleRequest(<wbr>ServletInitialHandler.java:<wbr>104)<br>
io.undertow.server.Connectors.<wbr>executeRootHandler(Connectors.<wbr>java:202)<br>
io.undertow.server.<wbr>HttpServerExchange$1.run(<wbr>HttpServerExchange.java:805)<br>
java.util.concurrent.<wbr>ThreadPoolExecutor.runWorker(<wbr>ThreadPoolExecutor.java:1142)<br>
java.util.concurrent.<wbr>ThreadPoolExecutor$Worker.run(<wbr>ThreadPoolExecutor.java:617)<br>
java.lang.Thread.run(Thread.<wbr>java:748)<br>
<br>
<br>
<br>
Rostislav<br>
<br>
______________________________<wbr>_________________<br>
resteasy-dev mailing list<br>
<a href="mailto:resteasy-dev@lists.jboss.org"
moz-do-not-send="true">resteasy-dev@lists.jboss.org</a><br>
<a
href="https://lists.jboss.org/mailman/listinfo/resteasy-dev"
rel="noreferrer" target="_blank" moz-do-not-send="true">https://lists.jboss.org/<wbr>mailman/listinfo/resteasy-dev</a><br>
</blockquote>
</div>
<br>
</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
resteasy-dev mailing list
<a class="moz-txt-link-abbreviated" href="mailto:resteasy-dev@lists.jboss.org">resteasy-dev@lists.jboss.org</a>
<a class="moz-txt-link-freetext" href="https://lists.jboss.org/mailman/listinfo/resteasy-dev">https://lists.jboss.org/mailman/listinfo/resteasy-dev</a>
</pre>
</blockquote>
<p><br>
</p>
</body>
</html>