users@jax-rs-spec.java.net

[jax-rs-spec users] Re: Section 3.7.8 should be clarified

From: Santiago Pericas-Geertsen <Santiago.PericasGeertsen_at_oracle.com>
Date: Wed, 29 Apr 2015 10:59:41 -0400

Sergey,

 This is basically a programmer error. Moreover, it may be possible that the entity is updated by a response filter. Thus, I donít think this change would be backward compatible.

 -1.

ó Santiago

> On Apr 29, 2015, at 9:05 AM, Sergey Beryozkin <sberyozkin_at_talend.com> wrote:
>
> Hi Santiago, All,
>
> Section 3.7.8 (determining the media types of responses) specifies how a response media type is determined.
>
> IMHO it is worth clarifying that this section is only effective if a response *entity is not null*.
>
> We have a test issue reported something like the following is done:
>
> public Response getMediaType() {
> return Response.ok().type(someMediType).build();
> }
>
> and the client is checking Content-Type.
>
> But it is wrong to return Content-Type if no entity is available, it is misleading at the very least as far as HTTP is concerned. It may not necessarily break a client but IMHO the JAX-RS related tests should not enforce the runtimes sending Content-Type with an empty body
>
> Do you agree ?
>
> Thanks, Sergey
>