Fwd: SPI to add JAX-RS annotations dynamically
by Alessio Soldano
Forwarding to the list :-)
---------- Forwarded message ----------
From: Alessio Soldano <asoldano(a)redhat.com>
Date: Wed, Sep 27, 2017 at 10:24 PM
Subject: Re: [resteasy-dev] SPI to add JAX-RS annotations dynamically
To: Christian Kaltepoth <christian(a)kaltepoth.de>
Hi Christian,
On Wed, Sep 27, 2017 at 9:19 PM, Christian Kaltepoth <christian(a)kaltepoth.de
> wrote:
>
> sorry for the delayed response. I agree that if some SPI would allow to
> modify the builders, it should be done before the resource is registered in
> the resource factory. Do you think such a SPI would be useful for others?
>
Probably yes, but your scenario might even be enough to justify it.
I would be happy to contribute some code if it improves portability between
> RESTEasy and the MVC RI.
>
Sure, feel free to work on that and send a PR.
> Thanks for pointing me to the resteasy-cdi integration. I'll have a deeper
> look at it in the next days.
>
OK, good, I hope that can offer some idea for integrating.
Cheers
Alessio
6 years, 7 months
Re: [resteasy-dev] resteasy jax-rs fail fast on entity validation exception
by Alessio Soldano
Hi John,
sorry, I'm a bit busy atm, anyway I'm forwarding your email to the
resteasy-dev list. We'll get back to you.
Cheers
Alessio
On Tue, Oct 24, 2017 at 11:59 AM, John O'Hara <johara(a)redhat.com> wrote:
> Alessio,
>
> I am not sure if you are the correct person to ask, if not please let me
> if there is someone more appropriate to ask.
>
> I have been investigating some unexpected behaviour in how entity
> validations exceptions are propagated through WF/EAP when http post
> requests are made via rest endpoints.
>
> One thing I have noticed in the resteasy-jaxrs module is that
> in org.jboss.resteasy.core.MethodInjectorImpl.invoke() the method
> parameters are validated [1], but the method is still invoked, irrespective
> of the outcome of the call to the validator [2]
>
> Is there is a possibility of failing a method invocation after the
> validation call [1], so that we do not invoke the method, which ends up
> failing anyway due to validation exceptions?
>
> Thanks
>
> John
>
> [1] https://github.com/resteasy/Resteasy/blob/master/
> resteasy-jaxrs/src/main/java/org/jboss/resteasy/core/
> MethodInjectorImpl.java#L119
> [2] https://github.com/resteasy/Resteasy/blob/master/
> resteasy-jaxrs/src/main/java/org/jboss/resteasy/core/
> MethodInjectorImpl.java#L140
>
> --
>
> JOHN O'HARA
>
> PRINCIPAL SOFTWARE ENGINEER
>
> Red Hat <https://www.redhat.com/>
> <https://red.ht/sig>
> TRIED. TESTED. TRUSTED. <https://redhat.com/trusted>
> @redhatway <https://twitter.com/redhatway> @redhatinc
> <https://instagram.com/redhatinc> @redhatsnaps
> <https://snapchat.com/add/redhatsnaps>
>
7 years
RESTEasy and need of Accept header
by Rostislav Svoboda
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)
Rostislav
7 years, 1 month