jsr339-experts@jax-rs-spec.java.net

[jsr339-experts] Re: Malformed media types and status codes

From: Sergey Beryozkin <sberyozkin_at_talend.com>
Date: Mon, 26 Sep 2011 14:58:33 +0100

I'm not sure if my reply to this message has been sent or not, there was
some Sent error, sorry for the duplication if it was.

What I was saying that 406 was Ok for me, though 400 seemed the right
code to me originally. The question is what are the expectations on the
web in general,
I did

curl -H "Accept: bar" www.amazon.com

and got their HTML page back. That is probably not the best example, but
I guess the servers are tolerable to/ignorable of Accept values

Cheers, Sergey

On 26/09/11 13:52, Julian Reschke wrote:
> On 2011-09-26 13:07, Marek Potociar wrote:
>>
>>
>> On 09/25/2011 11:07 PM, Sergey Beryozkin wrote:
>>> Hi
>>>
>>> I'm wondering, what should the specification say about cases where
>>> HTTP ContentType or Accept contain malformed values.
>>
>> You mean malformed in the sense of not following the definition in
>> HTTP 1.1 spec?
>> http://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.7
>>
>>>
>>> For example, should
>>>
>>> Accept: text
>>>
>>> result in 406 or 400 ?
>>
>> Depends on the side IMO.
>>
>> It would probably make sense to follow the "be conservative in what
>> you produce" guideline and fail early with an
>> exception on the client side.
>>
>> On the server side, all existing implementations should follow the
>> spec and send back 415 (in case of
>> malformed/unsupported Content-type) or 406 (in case of
>> malformed/unsupported Accept) - as per section 3.7.3, stage 3.a.
>> ...
>
> Malformed != Unsupported.
>
> Malformed should be 400.
>
> Best regards, Julian


-- 
Sergey Beryozkin
http://sberyozkin.blogspot.com
Talend - http://www.talend.com