Hi Andrei
On 29/01/13 12:51, Andrei Shakirin wrote:
Hi,
Would like to discuss the following:
CXF Rest service implementation processes javax.ws.rs (NotFoaundException,
BadRequestException) exceptions correctly.
But if these exception are thrown form exception mapper, client always receive
InternalServerError exception.
Is this behaviour specified by JAX-RS?
I'm actually not seeing anything specific in the text, but I think at
the moment that CXF is correct, because otherwise the question is how to
map these rethrown exceptions and we can have an infinity loop -
something the spec talks about, for example, an exception mapper sets a
Response entity - next MessageBodyWriter throws the exception again -
this 500, so I think it is 500 in this case too
I find convenient in some cases just to re-throw javax.ws.rs exceptions from
mapper and not build Response manually.
Sure, in this case it is easy :-), all WebApplicationException instances
have getResponse() method - so simply use exception.getResponse() - it
will have a proper status set, etc..
HTH, Sergey
WDYT?
Regards,
Andrei.