jsr339-experts@jax-rs-spec.java.net

[jsr339-experts] Re: [jax-rs-spec users] Response.readEntity and HTTP errors

From: Sergey Beryozkin <sberyozkin_at_talend.com>
Date: Fri, 13 Dec 2013 12:29:59 +0000

On 13/12/13 11:21, Marek Potociar wrote:
> I do not get the problem - if 404 response contains Book entity and you have a MBR for Book registered, the invocation should pass. If there is some other payload or there is no Book MBR, the invocation should fail with ProcessingException. ISE should be used typically if response has been closed already.
>
> Same for 3xx. Not sure where does your NotFoundException comes from in this case...
>
OK, you are right

Sergey
> Marek
>
> On 03 Dec 2013, at 17:19, Sergey Beryozkin <sberyozkin_at_talend.com> wrote:
>
>> Hi
>>
>> Consider:
>>
>> Response r = myClient.get();
>> assertEquals(404, r.getStatus());
>>
>> r.getEntity(Book.class);
>>
>> At the moment CXf throws ProcessingException; ISE is also mentioned in the docs, probably cleaner for 404, though we can have an HTTP error with the actual text - so we will still end up with ProcessingException.
>>
>> However, if we have a status >= 300, then should
>>
>> r.getEntity(Book.class);
>>
>> actually throw a WebApplicationException subclass such as NotFoundException if an entity type is not InputStream ?
>>
>> Or may be ProcessingException should have a linked WebApplicationException in such cases ?
>>
>> Do you agree it will make sense to review it for 2.1 ?
>>
>> Sergey
>