I have had a similar problem and worked it around by building a
CustomFaultOutInterceptor,
which handles everything that gets thrown for both REST and SOAP. Once you
have a single place to do it
you can translate Exception into HTTR response codes as well as you can
enchance
default Soap fault as appropriate.
Mike O'Neil-2 wrote:
>
> I have an ExceptionMapper which handles exceptions from my Rest
> service just fine. However when my "In" Interceptor throws a Fault,
> the ExceptionMapper does not handle it. Instead I get the standard
> (ugly) XML, e.g.:
>
> <ns1:XMLFault><ns1:faultstring>error
> message</ns1:faultstring></ns1:XMLFault>
>
> Is that the expected behavior? My server is set up like:
>
> <jaxrs:server id="service" address="/rest">
> <jaxrs:serviceBeans>
> <bean parent="myService" />
> </jaxrs:serviceBeans>
> <jaxrs:inInterceptors>
> <ref bean="myInterceptor"/>
> </jaxrs:inInterceptors>
> <jaxrs:providers>
> <ref bean="restExceptionMapper"/>
> </jaxrs:providers>
> </jaxrs:server>
>
>
> And my interceptor looks like:
>
> public class MyInterceptor extends AbstractPhaseInterceptor<Message> {
> public FormatSettingInterceptor() {
> super(Phase.PRE_STREAM);
> }
>
> @Override
> public void handleMessage(Message message) throws Fault {
> throw new Fault("Not handled by ExceptionMapper!");
> }
> }
>
> Any insight or help would be appreciated.
>
> Much thanks,
> Mike
>
>
--
View this message in context:
http://old.nabble.com/Fault-thrown-in-Rest-In-Interceptor-not-handled-by-ExceptionMapper-tp26833555p26834406.html
Sent from the cxf-user mailing list archive at Nabble.com.