users@jax-rs-spec.java.net

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

From: Jan Algermissen <jan.algermissen_at_nordsc.com>
Date: Thu, 9 May 2013 12:41:17 +0200

On 09.05.2013, at 12:01, Marek Potociar <marek.potociar_at_oracle.com> wrote:

> The javadoc mainly states that the method provides "a list of media types that are acceptable for the response" (it does use the "requested" term in the return value description though).
>
> The way I see it, the intention of the dedicated method is to help with acceptable media type processing and as such it should return */* in case there is no accept header present. I do agree that the javadoc should be clarified in that sense. I do not however agree that we should use this method as a mere proxy to the Accept header values, otherwise we're off-loading the burden of dealing with the "missing Accept header" use case to our users and that does not seem right. IOW, when invoking the method users are far more likely interested in what are the actual acceptable media types rather whether or not an Accept header is present in the request.
>
> Makes sense?

I actually do not see the problem.

A missing Accept header is absolutely equivalent to Accept: */*, IOW, with missing Accept: the client requests "I accept */*"

Jan


>
> Marek
>
> On May 8, 2013, at 11:54 PM, 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, then this method should return an empty list, IMO.
>> --
>> Bill Burke
>> JBoss, a division of Red Hat
>> http://bill.burkecentral.com
>