I think I do what you're asking for with a FaultListener

1) subclass FaultListener, make sure you read the docs on
faultOccurred what you return matters

2) in spring :
<cxf:bus>
   <cxf:properties>
      <entry key="org.apache.cxf.logging.FaultListener">
         <bean class="MyFaultListener" />
      </entry>


On 12/12/12, Ivan.Latysh <[email protected]> wrote:
> Sergey Beryozkin-5 wrote
>> 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 ?
>
> I have made a small project with a service class and an interceptor.
>
> It is an IntelliJ IDEA project. In the out/artifacts you have pre-built
> cxf_fault_interceptors.war that has 2 endpoints:
> /service/success?id=1 - always return SUCCESS message
> /service/fault?id=1 - always fail
>
> So to test the setup please deploy the war than hit 2 urls:
> /service/fault?id=1 - will throw RuntimeException that will be caught by
> the
> interceptor
> /service/fault?id=1ER - will newer get to the Interceptor
>
> Full project folder (21M):
> https://www.dropbox.com/sh/y7l43z26oabs0xg/stpb-AJWhu
>
> If you can catch parsing exception, please let me know how.
>
> Thank you in advance.
>
>
>
> --
> View this message in context:
> http://cxf.547215.n5.nabble.com/Intercepting-exceptions-on-the-server-side-tp5719964p5720077.html
> Sent from the cxf-user mailing list archive at Nabble.com.
>


-- 
Ted.

Reply via email to