users@jsr311.java.net

Re: Sorting accept media types

From: Bill Burke <bburke_at_redhat.com>
Date: Thu, 26 Feb 2009 08:46:40 -0500

 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."

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