Re: How to handle ClientAbortException in CXF ?

2015-12-23 Thread Sergey Beryozkin
Hi JAXRSOutInterceptor.handleWriteException checks JAX-RS ExceptionMapper so perhaps you can intercept that Exception and return Response with the code only from this exception mapper. Another option to try is to wrap Jackson with a custom JAX-RS MessageBoryWriter and handle the write

Re: How to handle ClientAbortException in CXF ?

2015-12-23 Thread Sumit Arora
Sergey, I tried using to write Exception Mapper : 1.Here MapperException - > IOException, ClientErrorException public class GTMClientExceptionMapper implements ExceptionMapper { public Response toResponse(IOException ce) { ErrorMessage errorMessage = new

Re: How to handle ClientAbortException in CXF ?

2015-12-23 Thread Sumit Arora
It comes here on exception mapper : public class GTMClientExceptionMapper implements ExceptionMapper { public Response toResponse(IOException ce) { // ErrorMessage errorMessage = new ErrorMessage(ce.getMessage(),400,"Exmaple Message "); return null; // return

Re: How to handle ClientAbortException in CXF ?

2015-12-23 Thread Sergey Beryozkin
Well, first thing to check is whether this mapper is invoked, note it is not auto-discovered by default, unless you explicitly enable the auto-discovery, so it needs to be registered in jaxrs:providers. But even if it is invoked, the problem is you still try to return some error message - the

Re: How to handle ClientAbortException in CXF ?

2015-12-23 Thread Sumit Arora
I have tried that as well, that didn't work : @Provider public class GTMGenericExceptionMapper implements ExceptionMapper { public Response toResponse(Throwable th) { ErrorMessage errorMessage = new ErrorMessage(th.getMessage(),500,"Example Message"); return

Re: How to handle ClientAbortException in CXF ?

2015-12-23 Thread Sergey Beryozkin
Try registering ExceptionMapper and see what happens Cheers. Sergey On 23/12/15 16:03, Sumit Arora wrote: Sergey, I tried using to write Exception Mapper : 1.Here MapperException - > IOException, ClientErrorException public class GTMClientExceptionMapper implements ExceptionMapper {

Re: How to handle ClientAbortException in CXF ?

2015-12-23 Thread Sergey Beryozkin
As I have already said, return Response with the error code only. Returning null indicates to the runtime that the mapping has not been done in which case it has to rethrow the original exception. If returning a response with the code only does not help then move to the alternative 2 (write