users@jsr311.java.net

Re: ResponseBuilder.type()

From: Stephan Koops <Stephan.Koops_at_web.de>
Date: Fri, 20 Jun 2008 12:54:27 +0200

Hi Paul,
> 1) Return an not acceptable response, plus see the thread titled
>
> "status 406 if return object not serializable for POST, PUT,
> DELETE"
>
> 2) Ignore the client accept header.
>
> 3) It is an error.
>
>
> There is also another case:
>
> @ProduceMime({"application/bar", "application/foo"})
> void Response get() {
> return response.ok().
> type(""application/baz").entity(someEntity).build();
> }
>
> IMHO i think this should be an error because it contradicts the
> declaration in @ProduceMime.
IMO it should not be an error, because "HTTP/1.1 servers are allowed to
return responses which are not acceptable according to the accept
headers sent in the request." (from
http://tools.ietf.org/html/rfc2616#section-10.4.7)
I think: If the Response method sets a media type, the one of
@ProduceMime must be ignored. An example for other media types could be,
if the method want to send details for an error (or redirection with
options) status.

best regards
   Stephan