cxf-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mike O'Neil" <mton...@gmail.com>
Subject Fault thrown in Rest In-Interceptor not handled by ExceptionMapper
Date Thu, 17 Dec 2009 19:24:44 GMT
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

Mime
View raw message