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

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

From: Julian Reschke <julian.reschke_at_gmx.de>
Date: Mon, 26 Sep 2011 14:52:27 +0200

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