Hi, do you still throw a Fault from your interceptor ? Or
WebApplicationException ?
Cheers, Sergey
On 17/01/14 16:17, nikosdim wrote:
Hi Andrei
I updated to cxf 3.0.0 and I am trying to make exception mapping to work but
not luck until now.
My exception mapper:
public class MyExceptionMapper implements
ExceptionMapper<WebApplicationException>{
@Override
public Response toResponse(WebApplicationException exception) {
Response response = Response
.status(Status.INTERNAL_SERVER_ERROR)
.type(MediaType.APPLICATION_JSON)
.entity("{\"message\":\"Please contact system
administrators.\"}").build();
return response;
}
}
My inbound interceptor is in PRE_LOGICAL phase which is after the UNMARSHAL
phase (but it should not matter since it is version 3.0.0) and in the
interceptor I have "throw new WebApplicationException();"
in my xml configuration file I have registered my interceptor
<cxf:bus>
<cxf:inInterceptors>
<bean
class="com.ba.oasis.interceptors.MyLoginInInterceptor"
id="MyLoginInInterceptor"/>
</cxf:inInterceptors>
<cxf:outInterceptors>
</cxf:outInterceptors>
</cxf:bus>
and also the mapper in the providers
<jaxrs:server address="/" id="services">
<jaxrs:serviceBeans>
<bean
class="com.ba.oasis.resources.HpsimManagedObjectsResource" />
</jaxrs:serviceBeans>
<jaxrs:providers>
<bean
class="org.apache.cxf.jaxrs.ext.search.SearchContextProvider" />
<bean class="com.ba.oasis.utils.MyJAXBProvider" />
<bean class="com.ba.oasis.utils.MyJSONProvider"
id="JsonpProvider">
<property name="ignoreNamespaces" value="true"
/>
<property name="dropRootElement" value="false"
/>
<property name="supportUnwrapped" value="true"
/>
</bean>
<bean
class="com.ba.oasis.exceptions.MyExceptionMapper"/>
</jaxrs:providers>
<jaxrs:properties>
<entry key="ignore.matrix.parameters" value="true" />
<entry key="search.lax.property.match" value="true" />
<entry key="map.cxf.interceptor.fault" value="true" />
</jaxrs:properties>
</jaxrs:server>
When I am calling my service it never gets to the "toResponse()" of my
mapper. What am I doing wrong?
Thanks
--
View this message in context:
http://cxf.547215.n5.nabble.com/Custom-Response-from-handleFault-JAX-RS-tp5738651p5738714.html
Sent from the cxf-user mailing list archive at Nabble.com.