users@jax-rs-spec.java.net

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

From: Sergey Beryozkin <sberyozkin_at_talend.com>
Date: Wed, 29 Apr 2015 16:17:31 +0100

Hi,

I don't understand what are you opposed to.

So a programmer has written a bad code missing setting an entity, that
is understood.

Why sending Content-Type without a body should be enforced ? Where in
HTTP specs it is advised/recommended ?

It does not make sense from a practical point of view.

If RI does it why should other frameworks bear the same burden and send
redundant headers ?

Ok, I don't mind if the section is staying unchanged. Does not matter.

What matters to me though is though an anti-pattern gets enforced at the
test level...

Sergey.





On 29/04/15 15:59, Santiago Pericas-Geertsen wrote:
> 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
>>
>