users@jax-rs-spec.java.net

[jax-rs-spec users] [jsr339-experts] Re: Re: Exceptions for representing HTTP errors

From: Marek Potociar <marek.potociar_at_oracle.com>
Date: Tue, 15 May 2012 20:21:30 +0200

On May 15, 2012, at 8:13 PM, Julian Reschke wrote:

> On 2012-05-15 19:56, Bill Burke wrote:
>> ...
>>
>> I agree mostly with Marek. iMO, I don't see the problem with having both
>> fine-grain exceptions for each and *every* code and family super
>
> Just keep in mind that new status codes can and will be defined.
>
>> classes. Really what is the harm? Especially if you put them in a
>> separate package? The exception classes would be really really simple...
>> Additionally, maybe 3xx have a helper method that returns the redirect
>> URL. 503 has a helper method returning the Retry-After header, etc...
>
> s/URL/URI/ :-)
>
> In fact, the exceptions need to provide access to all information in the HTTP response, and that includes the status code, the response header fields *and* the payload.

That is IMO most important on the client-side which is why I suggested the constructor that takes the original response.

Marek

>
>> ...
>
> Best regards, Julian