users@jsr311.java.net

Re: SC_OK or SC_NO_CONTENT

From: Paul Sandoz <Paul.Sandoz_at_Sun.COM>
Date: Mon, 19 May 2008 15:18:16 +0200

Bill Burke wrote:
> HTTP Spec says:
>
> "A successful response SHOULD be 200 (OK) if the response includes an
> entity describing the status, 202 (Accepted) if the action has not yet
> been enacted, or 204 (No Content) if the action has been enacted but the
> response does not include an entity."
>
> IMO, you should be able to return anything you want as the spec says
> "SHOULD" and not "MUST". Since you are building the response, IMO,
> Jersey is in error.

Correct. Coincidently someone logged an issue about the other week [1].
I just fixed it.


> If you were not building the Response object
> yourself, then it should be 204 if there is a void return type, 200 if
> there is a non-void. I'll ping the expert group.
>

More specifically the status code set in built and returned Response
should not be overridden by the JAX-RS runtime.

Paul.

[1] https://jersey.dev.java.net/issues/show_bug.cgi?id=61

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