camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sergey Beryozkin <sberyoz...@gmail.com>
Subject Re: CXF jaxrs custome exception mapper with camel
Date Mon, 07 Apr 2014 18:33:25 GMT
Hi
The Camel CXFRS invoker might need to be updated to delegate to CXF and 
see if it can map an exception to Response, I'll investigate

Cheers, Sergey
On 07/04/14 10:20, vrahul wrote:
> Hi,
> I am trying to use ExceptionMapper class for my custom exception, below is
> my custom exception mapper class
>
> import javax.ws.rs.core.Response;
> import javax.ws.rs.ext.ExceptionMapper;
> import javax.ws.rs.ext.Provider;
>
> import com.my.flm.item.exception.CustomException;
>
> @Provider
> public class ItemExceptionMapper implements ExceptionMapper<CustomException>
> {
>
>      @Override
>      public Response toResponse(CustomException exception) {
>          System.out.println("ItemExceptionMapper-toResponse");
>          Response.Status status;
>          status = Response.Status.INTERNAL_SERVER_ERROR;
>          return Response.status(status).header("exception",
> exception.getMessage()).build();
>      }
> }
>
> I have added this class to my cxf server provider list
>
> <cxf:rsServer id="itemService"
>          address="{{esb.item.rest.address}}"
>          serviceClass="com.my.esb.service.flm.ItemServiceImpl"
>          loggingFeatureEnabled="true">
>          <cxf:providers>
>              <bean class="org.codehaus.jackson.jaxrs.JacksonJsonProvider"/>
> 	    <bean class="com.my.flm.esb.exception.ItemExceptionMapper"/>
>          </cxf:providers>
>      </cxf:rsServer>
>
> But when ever ItemException is thrown from the background call, i can see it
> never went through my exception mapper class.
> Is there any one who has used the ExceptionMapper class with camel. I can
> see the same exception mapper  class is working very fine with mule and
> spring-web. But when it comes to camel it always surprising. :(
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/CXF-jaxrs-custome-exception-mapper-with-camel-tp5749882.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>



Mime
View raw message