dev@jsr311.java.net

Re: JSR311: Header and Response Code constants

From: Paul Sandoz <Paul.Sandoz_at_Sun.COM>
Date: Wed, 19 Mar 2008 14:18:14 +0100

Marc Hadley wrote:
> On Mar 14, 2008, at 4:13 PM, Marc Hadley wrote:
>
>> On Mar 14, 2008, at 3:32 PM, Bill Burke wrote:
>>
>>> Sure, but there is a list of currently
>>> defined/registered/commonly-used/whatever headers/codes.
>>>
>>> What I really meant was I want to have things like OK and
>>> CONTENT-TYPE as constants as well.
>>>
>> OK, I'm fine with that since it allows the API and impl classes to use
>> those. I just don't want to add in every conceivable header and code
>> since the mass would obscure the most common/useful ones.
>>
> Give that we'll have
>
> Response r = Response.status(Status.NO_CONTENT).build();
>
> it seems redundant to also have
>
> Response r = Response.noContent().build();
>

I rather like the conciseness of the latter, plus i think for common
stuff it reads better and links more easily to the JavaDoc for specified
behaviour. I found such methods convenient when we added them as opposed
to using status (using a constant type or otherwise).

It is also more consistent if things are change:

   Response.ok(entity).build();
   Response.ok().entity(entity).build();

(something that i learned was important to maintain when using the
builder model with the Jersey client API).

Paul.

> Unless anyone wants to object I intend to remove the no-arg static
> methods of Response (ok, noContent, serverError, notModified) when I add
> the Status constants ?
>
> I'll leave the variants with arguments since they nicely group together
> a set of interrelated metadata.
>
> Marc.
>
>>
>>> Marc Hadley wrote:
>>>> On Mar 14, 2008, at 1:12 PM, Bill Burke wrote:
>>>>> Just wanted to add that having a complete list of headers/code
>>>>> constants is invaluable in testing.
>>>>>
>>>> There is no complete list, both headers and status codes are
>>>> extensible.
>>>> Marc.
>>>> ---
>>>> Marc Hadley <marc.hadley at sun.com>
>>>> CTO Office, Sun Microsystems.
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: dev-unsubscribe_at_jsr311.dev.java.net
>>>> For additional commands, e-mail: dev-help_at_jsr311.dev.java.net
>>>
>>> --
>>> Bill Burke
>>> JBoss, a division of Red Hat
>>> http://bill.burkecentral.com
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: dev-unsubscribe_at_jsr311.dev.java.net
>>> For additional commands, e-mail: dev-help_at_jsr311.dev.java.net
>>>
>>
>> ---
>> Marc Hadley <marc.hadley at sun.com>
>> CTO Office, Sun Microsystems.
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: dev-unsubscribe_at_jsr311.dev.java.net
>> For additional commands, e-mail: dev-help_at_jsr311.dev.java.net
>>
>
> ---
> Marc Hadley <marc.hadley at sun.com>
> CTO Office, Sun Microsystems.
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe_at_jsr311.dev.java.net
> For additional commands, e-mail: dev-help_at_jsr311.dev.java.net
>

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