users@jax-rs-spec.java.net

[jax-rs-spec users] [jsr339-experts] Re: Re: getAcceptableMediaTypes() should return empty list

From: Santiago Pericas-Geertsen <Santiago.PericasGeertsen_at_oracle.com>
Date: Thu, 9 May 2013 08:56:56 -0400

On May 9, 2013, at 6:03 AM, Marek Potociar <marek.potociar_at_oracle.com> wrote:

> As I explained in my other email, this is a bug in the javadoc IMO. At least my intention when writing it was not to 1:1 mimic the on-the-wire Accept header data but to provide information about acceptable media types.

 This makes sense. If we have dedicated method for a certain header, let's make it a bit smarter. It's already doing sorting, so it's different from getting the header value in raw form.

-- Santiago

> On May 9, 2013, at 9:06 AM, Bill Burke <bburke_at_redhat.com> wrote:
>
>>
>>
>> On 5/9/2013 2:47 AM, Jan Algermissen wrote:
>>>
>>> On 09.05.2013, at 08:45, Bill Burke <bburke_at_redhat.com> wrote:
>>>
>>>>
>>>>
>>>> On 5/8/2013 6:10 PM, Jan Algermissen wrote:
>>>>>
>>>>> On 08.05.2013, at 23:54, Bill Burke <bburke_at_redhat.com> wrote:
>>>>>
>>>>>> I'm looking at:
>>>>>> com.sun.ts.tests.jaxrs.api.client.webtarget.JAXRSClient.requestNoArgTest();
>>>>>>
>>>>>> It seems that it expects ClientRequestContext.getAcceptableMediaTypes() to return "*/*" by default if there is no Accept header. Not sure I agree with this. The Javadoc says it returns the *requested* media types, i.e., what you specified in an Accept header. If there is no accept header,
>>>>>
>>>>> " A request without any Accept header field implies that the user agent
>>>>> will accept any media type in response." .... aka */*
>>>>>
>>>>> http://tools.ietf.org/html/draft-ietf-httpbis-p2-semantics-22#section-5.3.2
>>>>>
>>>>
>>>> Correct, so getAcceptableMediaTypes() should return an empty list as no specific media type was requested.
>>>
>>> No, sending no Accept is equivalent to sending Accept: */*
>>>
>>
>> Incorrect. The HTTP spec implies */*. In other words, that you should assume */*. The javadoc, on the hand, talks about requested media types. There was nothing requested explicitly.
>>
>> --
>> Bill Burke
>> JBoss, a division of Red Hat
>> http://bill.burkecentral.com
>