users@jsr311.java.net

Re: Sorting accept media types

From: Sergey Beryozkin <sberyozk_at_progress.com>
Date: Thu, 26 Feb 2009 14:18:37 -0000

>
> From HTTP 1.1 spec on Accept Header:
>
> "If more than one media range applies to a given type, the most specific
> reference has precedence."

I've got a comment in one of CXF JIRAs :

> According to the JAX-RS311 specification(Jun 27,2008 0.9version), section 3.8 Determining the MediaType of Responses
> 4. Sort A and P in descending order, each with a primary key of q-value and secondary key of specificity 8
> (n/m > n/* > */*).

which confused me. Checking the latest JAXRS spec made things clearer :-)

Thanks, Sergey

>
> Sergey Beryozkin wrote:
>> Hi
>>
>> 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 ?
>>
>> 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 ?
>>
>> Thanks, Sergey
>>
>
> --
> Bill Burke
> JBoss, a division of Red Hat
> http://bill.burkecentral.com
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jsr311.dev.java.net
> For additional commands, e-mail: users-help_at_jsr311.dev.java.net
>