Thank you. It definitely helps. Regards, Parimal
On Tue, Dec 15, 2009 at 8:12 AM, green.shore <[email protected]>wrote: > > Hi Parimal, > > I might be too late, but still it will help other users. > Answer for your query : > > http://old.nabble.com/-JAXRS--ExceptionMappers-not-called-td25136326.html#a25149436 > > Regards, > novice > > > > > Parimal Dhinoja wrote: > > > > Thank vickatvuuch, > > > > Sorry for late reply but I was stuck on some other priorities. I will try > > to > > implement both to see which one best suited with my requirement. Can you > > please let me know how to register both(Mapper and FaultOutInterceptor) > in > > beans.xml. I am using Spring. > > > > Thanks Again. > > > > Regards, > > Parimal > > > > > > On Wed, Dec 2, 2009 at 8:44 PM, vickatvuuch <[email protected]> wrote: > > > >> > >> register rest exception mapper and convert there, for example see below: > >> note that the mapper works fine in REST only case, I actually ended up > >> building my own CustomFaultOutInterceptor such as this: public class > >> CustomFaultOutInterceptor extends AbstractPhaseInterceptor<Message> > >> > >> public class RestExceptionMapper implements ExceptionMapper<Exception> > >> { > >> private static Log logger = > >> LogFactory.getLog(RestExceptionMapper.class); > >> > >> public Response toResponse(Exception exception) > >> { > >> if (exception instanceof FooAuthException) > >> { > >> return > >> > Response.status(Response.Status.FORBIDDEN).type(MediaType.APPLICATION_XML). > >> entity(formatEntityMessage(exception, xmlHead)).build(); > >> } > >> > >> > >> Parimal Dhinoja wrote: > >> > > >> > Hi all, > >> > > >> > based on certain conditions, I need to set different HttpResponse Code > >> > back > >> > to client. I am thinking of throwing different type of Exception from > >> > service method based on condition met. and somewhere I need to catch > >> these > >> > exception and need to set response code based on exception thrown. > >> > > >> > Please let me know, how can I do this? > >> > > >> > -- > >> > Regards, > >> > Parimal > >> > "Nothing is stationary,Change is a part of Life" > >> > > >> > > >> > >> -- > >> View this message in context: > >> > http://old.nabble.com/How-to-handle-exceptions-in-JAx-rs-service-and-convert-it-to-Http--Response-code-based-on-type-of-Exception-tp26614920p26619747.html > >> Sent from the cxf-user mailing list archive at Nabble.com. > >> > >> > > > > > > -- > > Regards, > > Parimal > > "Nothing is stationary,Change is a part of Life" > > > > > > -- > View this message in context: > http://old.nabble.com/How-to-handle-exceptions-in-JAx-rs-service-and-convert-it-to-Http--Response-code-based-on-type-of-Exception-tp26614920p26794552.html > Sent from the cxf-user mailing list archive at Nabble.com. > > -- Regards, Parimal "Nothing is stationary,Change is a part of Life"
