users@jsr311.java.net

Re: Sorting accept media types

From: Sergey Beryozkin <sberyozk_at_progress.com>
Date: Fri, 27 Feb 2009 17:22:18 -0000

Hi Marc

this is appreciated, thanks fopr your help. In CXF we use the sorted accept values for the *initial* method selection, that is the
methods are comparted to each other the way you described but the sorted values are used form a start, (and in the end too), to
limit a set of possible matching candidates from a start...
However, there're few things which still need to tweaked according to the feedback I've got here,
thanks again, Sergey

----- Original Message -----
From: "Marc Hadley" <Marc.Hadley_at_Sun.COM>
To: <users_at_jsr311.dev.java.net>
Sent: Thursday, February 26, 2009 9:59 PM
Subject: Re: Sorting accept media types


> On Feb 26, 2009, at 5:04 AM, Sergey Beryozkin wrote:
>>
>> If we have
>>
>> Accept : text/plain,text/xml;q=0.9, */*
>>
>> and two methods with one producing text/xml and another one application/pdf then what format has to be returned ?
>>
>> text/xml is more specific than */* but */* has a quality factor 1.0. JAXRS specification says a quality factor is a primary key,
>> but in this case it does seem correct to return text/xml, is it correct ?
>>
> The method chosen, all else being equal, is determined by 3.7.2 3(b) which punts to section 14.1 or RFC 2616. In the example you
> give I think that would be application/pdf since the implied q-value is 1 vs 0.9 for text/xml.
>
> This does seem unintuitive and Apache can cook Accept header values to compensate, see "Fiddling with Quality Values":
>
> http://httpd.apache.org/docs/1.3/content-negotiation.html
>
>>
>> Another question :
>>
>> Accept : application/pdf;q=0.9, text/*
>>
>> text/* is more specific than */* but it's still less specifc than application/pdf. Its quality factor is 1.0 though. So is it
>> text/xml format (given the example with 2 methods above) that has to be returned ?
>>
> If there are two methods, one producing application/pdf and the other text/xml then I think the text/xml one should be chosen all
> else being equal.
>
> Marc.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jsr311.dev.java.net
> For additional commands, e-mail: users-help_at_jsr311.dev.java.net
>