users@jsr311.java.net

RE: Re: Sorting accept media types

From: Sergey Beryozkin <sberyozk_at_progress.com>
Date: Thu, 26 Feb 2009 15:55:03 -0500

Hi Stephan

So HTTP spec says that specificity is the primary factor, right? Same as
JAXRS spec which says that a quality factor is a secondary key. If we
have

Accept : text/plain,text/xml;q=0.9, application/*

application/* is less specific than text/xml even though it has a higher
quality factor.

Another very similar example.

Accept : application/xml;q=0.9, application/*

If we have two methods that can produce xml and json then
it does look like it's application/xml that needs to be returned, even
though application/* has a higher quality factor ?

If not then what does it mean to have a specificity as a primary key ?

Cheers, Sergey

-----Original Message-----
From: Stephan.Koops_at_web.de [mailto:Stephan.Koops_at_web.de]
Sent: 26 February 2009 18:33
To: users_at_jsr311.dev.java.net
Subject: Re: Sorting accept media types

Hi Sergey,

returning text/xml is not wrong, because it will not be in conflict with

"*/*". If the client sends
Accept : text/plain,text/xml;q=0.9, applicatio/*
then returning text/xml is wrong

best regards
   Stephan

Sergey Beryozkin schrieb:
> 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
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe_at_jsr311.dev.java.net
For additional commands, e-mail: users-help_at_jsr311.dev.java.net