[jboss-dev-forums] [JBoss AS 7 Development] - RestEasy PostProcessInterceptor chain not traversed if response is created by ExceptionMapper

rushead do-not-reply at jboss.com
Tue Jun 26 03:38:09 EDT 2012


rushead [https://community.jboss.org/people/rushead] created the discussion

"RestEasy PostProcessInterceptor chain not traversed if response is created by ExceptionMapper"

To view the discussion, visit: https://community.jboss.org/message/744157#744157

--------------------------------------------------------------
Hi all.

A little explanation before:
I had a problem with my custom logging implementation (based on a ServletFilter) which is caused by the fact that the HttpHeader entries are applied at the HttpServletResponse right before the message body is written.
Therefore I wanted to implement a PostProcessInterceptor which applies the necessary HttpHeader entries, which are already contained in the ServerResponse, at the injected HttpServletResponse.

If the resource does not throw an exception my implementation works as expected.
If an exception is thrown and an ExceptionMapper is creating the response, the PostProcessInterceptor chain is not traversed.

In my opinion the problem is caused by the following line in resteasy-jaxrs:
 https://github.com/resteasy/Resteasy/blob/master/jaxrs/resteasy-jaxrs/src/main/java/org/jboss/resteasy/core/SynchronousDispatcher.java#L335 https://github.com/resteasy/Resteasy/blob/master/jaxrs/resteasy-jaxrs/src/main/java/org/jboss/resteasy/core/SynchronousDispatcher.java#L335
The interceptor chain is not applied to the created Response before writing / sending it.

My question is now:
Is this an expected behavior? In my opinion the interceptor chain should be traversed in every case.
I didn't create a new issue in the resteasy jira because I'm not sure if this behavior is expected.

My current workaround:
Currently I create the interceptor, inject the properties and add it to the response within my abstract ExceptionMapper implementation. (<-- quite ugly, I know...)

Thanking you in anticipation.
--------------------------------------------------------------

Reply to this message by going to Community
[https://community.jboss.org/message/744157#744157]

Start a new discussion in JBoss AS 7 Development at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2225]

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-dev-forums/attachments/20120626/a15b0850/attachment.html 


More information about the jboss-dev-forums mailing list