users@jersey.java.net

Re: error handling

From: Paul Sandoz <Paul.Sandoz_at_Sun.COM>
Date: Tue, 17 Jun 2008 11:50:41 +0200

Paul Sandoz wrote:
> Paul Sandoz wrote:
>>> 1) The first issue I have is about the selection of the type: XML or
>>> JSON that will be used. Let's say I have a resource like that
>>> (comment/question are in the code):
>>>
>>> @GET
>>> @ProduceMime({"application/xml", "application/json"})
>>> public Response get() {
>>>
>>> if (!isValid) {
>>> // Is it possible here to have the ProduceMime apply to
>>> the entity ErrorConverter (which is jaxb bean)?
>>> throw new WebApplicationException(Response.status(400).entity(new
>>> ErrorConverter(400, "name", "description")).build());
>>> }
>>>
>>> // here the ProduceMime is applied and I would like to have
>>> the same behaviour when the error is thrown
>>> return Response.status(200).entity(new
>>> ProductConverter("name", "description")).build();
>>> }
>>>
>>
>> Off the top of my head i don't think that will work at the moment. But
>> it should be possible to fix. (Note that it will work if you just
>> return Response rather than throw an exception :-) ). Could you log an
>> issue?
>>
>
> I have just found an existing issue:
>
> https://jersey.dev.java.net/issues/show_bug.cgi?id=37
>

This issue is now fixed.

Paul.

-- 
| ? + ? = To question
----------------\
    Paul Sandoz
         x38109
+33-4-76188109