On 11/12/12 14:43, Ivan.Latysh wrote:
Sergey Beryozkin-5 wrote
That refers to the in fault interceptors and as I said they will not be
called on the server side, this is why the "outFaultInterceptors"
section as typed above has to be used...

outFaultInterceptors are not called on parsing exceptions. They are not even
a part of the fault chain.
It is clearly visible from the log I have provided.

And here is why.

1) Factory ... hardcoded providers, not smart for a framework, It should be
configurable, at least.

Is 1) supposed to explain why your custom out fault interceptor is not called ?

I have experimented with systests/jaxrs/.../JAXRSClientServerBookTest.
It (in BookServer) registers a custom out fault interceptor. It catches the errors thrown from the application code (when no appropriate JAX-RS exception mapper), from CXF JAX-RS RequestHandler Filters (run by JAXRSInInterceptor) and I've updated JAXRSInInterceptor.handleMessage just to throw RuntimeException and this out fault interceptor still catches it.

Furthermore, JAXRSInInterceptor has handleFault handler and this is called all the time too when the exception gets thrown, before the out fault handler is invoked.

I wonder why it does not work at all in your case ? Have you seen me suggesting to use "outFaultInterceptors" configuration block ?


Than in JAXRSInInterceptor exception is caught and pushed to a default
WebApplicationExceptionMapper that has been statically configured on the
factory ...


So at the end there are no way to catch an exception as exception handling
is hard coded. And even if I register my own ExceptionMapper on the
SHARED_FACTORY the default one takes precedence ... see
ExceptionMapperComparator class in
org.apache.cxf.jaxrs.provider.ProviderFactory


First of all - this is to do with managing JAX-RS ExceptionMappers, CXF out fault interceptors are not part of JAX-RS so ProviderFactory is not aware of them. Next - are you talking about not able to register a custom WebApplicationException Mapper ? It is definitely possible to do, register it as a jaxrs:provider

Sergey





--
View this message in context: 
http://cxf.547215.n5.nabble.com/Intercepting-exceptions-on-the-server-side-tp5719964p5720037.html
Sent from the cxf-user mailing list archive at Nabble.com.

Reply via email to