users@jax-rs-spec.java.net

[jax-rs-spec users] Re: Fwd: [jsr339-experts] Possible issues with section 3.8 and sentences 9/10

From: Sergey Beryozkin <sberyozkin_at_talend.com>
Date: Tue, 23 Apr 2013 15:28:03 +0100

On 23/04/13 15:12, Reto Bachmann-Gmür wrote:
> On Apr 23, 2013 12:50 AM, "Sergey Beryozkin" <sberyozkin_at_talend.com
> <mailto:sberyozkin_at_talend.com>> wrote:
>
> >
> > Hi
> >
> > Section 3.8 concludes with
> >
> > 9. If M contains ‘*/*’ or ‘application/*’, set Mselected =
> ‘application/octet-stream’, finish.
> > 10. Generate a NotAcceptableException (406 status) and no entity.
> >
> > I'm seeing an early test failing where we have
> >
> > Accept: text/*
> > Produces: text/*
> >
> > CXF produces: 200 + application/octet-stream, test expects 406.
> > It is not a big problem for us to make sure that if a wildcard
> response types does not meet requirements from 9, them it is 406 (as per
> 10.), however, I wonder, should we always do 9. whenever a response type
> contains "*", not only if it is a wildcard or application/* ?
> >
> > It is kind of strange to get 406 returned when a match has been
> successful.
>
> I think it's a bug in the spec: if accepting text/something results in a
> 200 response while accepting text/* results in s 406 this goes against
> the semantics imposed by http. The server should return text/something
> or text/somethingelse. This is not about improving the algorithm but
> about fixing it.
>
> Glad you spotted this.

I guess we have to thank the TCK team which really did work hard to test
every sentence of the spec, I'd not notice otherwise :-)

Thanks, Sergey

>
> Cheers,
> Reto
>
>
> >
> > I can open a minor improvement request for 2.1 if you agree
> >
> > Sergey
> >
>
>