Accepted media type quality is always 1.0

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Accepted media type quality is always 1.0

Christian Bauer
This is Restlet 2.0.0:

public class FooServerResource extends ServerResource {

    @Override
    protected Representation doNegotiatedHandle() throws ResourceException {
        for (Preference<MediaType> preference : getRequest().getClientInfo().getAcceptedMediaTypes()) {
            System.out.println("### PREF: " + preference);
        }
        return super.doNegotiatedHandle();
    }

...
}

curl -v -H 'Accept: application/xhtml+xml,text/xml;q=0.9,text/plain;q=0.8' ...

Output:

### PREF: application/xhtml+xml:1.0
### PREF: text/xml:1.0
### PREF: text/plain:1.0

This is not just a cosmetic error, I can't get negotiation to work based on quality levels.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

RE: Accepted media type quality is always 1.0

Thierry Boileau
Hi Christian,

I'm bit perplexed too. I've just tried with the sample resource and the following command line:
curl -v -H 'Accept: application/xhtml+xml, text/xml;q=0.9,text/plain;q=0.8' http://localhost:8182/test

The console prints the correct quality figures. I send you my sample eclipse project. Could you check it?


best regards,
Thierry Boileau

------------------------------------------------------
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2638003

testChristian.zip (831K) Download Attachment
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

RE: Accepted media type quality is always 1.0

Christian Bauer
It works with the built-in server connector but fails with the Simple connector. I've added simple-4.1.20.jar and org.restlet.ext.simple.jar from Restlet 2.2.0 and then always received quality level 1.0.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Accepted media type quality is always 1.0

Jonathan Hall-2
I've just upgraded to the latest snapshot and getVariants() is showing
empty for anything but the internal connector.
Related?

http://restlet.tigris.org/issues/show_bug.cgi?id=1156

On 26/07/10 06:54, Christian Bauer wrote:
> It works with the built-in server connector but fails with the Simple
> connector. I've added simple-4.1.20.jar and org.restlet.ext.simple.jar from
> Restlet 2.2.0 and then always received quality level 1.0.
>
>

------------------------------------------------------
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2638919
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Accepted media type quality is always 1.0

Christian Bauer
The same problem with Restlet 2.2.0 ext.jetty and jetty 7.0.1, 7.1.1, 7.1.2, and 7.1.3: Content negotiation doesn't work at all because the quality level is always 1.0 on the receiving resource. My guess is that this is true for all other server connectors except the built-in connector.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

RE: Accepted media type quality is always 1.0

jlouvel
Administrator
Hi Christian,

You have probably noticed it by now, but this bug has been fixed. See related issue:
http://restlet.tigris.org/issues/show_bug.cgi?id=1156

Best regards,
Jerome
--
Restlet ~ Founder and Technical Lead ~ http://www.restlet.o​rg
Noelios Technologies ~ http://www.noelios.com




-----Message d'origine-----
De : Christian Bauer [mailto:[hidden email]]
Envoyé : mercredi 28 juillet 2010 08:18
À : [hidden email]
Objet : Re: Accepted media type quality is always 1.0

The same problem with Restlet 2.2.0 ext.jetty and jetty 7.0.1, 7.1.1, 7.1.2, and 7.1.3: Content negotiation doesn't work at all because the quality level is always 1.0 on the receiving resource. My guess is that this is true for all other server connectors except the built-in connector.

--
View this message in context: http://restlet-discuss.1400322.n2.nabble.com/Accepted-media-type-quality-is-always-1-0-tp5334856p5345246.html
Sent from the Restlet Discuss mailing list archive at Nabble.com.

------------------------------------------------------
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2639352

------------------------------------------------------
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2667212
Loading...