Hi If I were a user and found CXF interceptors were doing exactly what I wanted then I would worry the least about the lost of total portability which is a bit unrealistic IMHO any way. It's open source and developers having enough experience to migrate will spend 30 mins on rewriting the interceptors to exception mappers.
ExceptionMappers must be able to catch all the exceptions generated immediately after JAXRSInInterceptor has been invoked, whether generated by the JAX-RS runtime or by the application filters and code, readers/writers. If it's not the case then it is a bug - please report it. Custom CXF out fault interceptors will also catch all the exceptions. When having a JAX-WS & JAX-RS combined, having CXF fault interceptors can be a better option, same for custom in/out CXF interceptors vs CXF JAX-RS filters. By the way, I believe all the JAX-RS stacks offer the filter support - which is unlikely to be standardized in the short term. Sergey On Sat, Feb 5, 2011 at 10:00 AM, Glen Mazza <[email protected]> wrote: > 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 > > >
