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

[jsr339-experts] Response.readEntity and HTTP errors

From: Sergey Beryozkin <sberyozkin_at_talend.com>
Date: Tue, 3 Dec 2013 16:19:13 +0000

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