ExceptionMapper is also portable across different REST implementations.
Usage of interceptors for exception handling may lead to nonstandard,
project-specific methods of handling exceptions (may need to document
more for other developers to understand).
Glen
On 05.02.2011 00:48, [email protected] wrote:
Hi All,
I wanted to know the pros and cons of using Exception Mapper and Interceptor
in CXF REST service. Below I have listed some of the pros and cons with my
limited knowledge on CXF Rest API. Please correct me if am wrong.
Also Please suggest me which is the best way of handling the exception.
1. Exception mapper:
Pros:
ExceptionMapper can map the exception to the certain response without
acknowledging the JAXRSInvoker that exception occurred.
Cons:
We cannot map the all runtime (un-checked) exception to the response.
i.e, ExceptionMapper is not able to map the all runtime exception. I tried
this :-)
2. Interceptor:
Pros:
Cons:
JAXRSInvoker will know that exception occurred and it will try to construct
the response.
--
Glen Mazza
Software Engineer, Talend (http://www.talend.com)
blog: http://www.jroller.com/gmazza