Hi Fabio,

This looks like a bug. I've just entered a report:

"Issue with content-negotiation and JAX-RS"
http://restlet.tigris.org/issues/show_bug.cgi?id=730

Best regards,
Jerome Louvel
--
Restlet ~ Founder and Lead developer ~ http://www.restlet.org
Noelios Technologies ~ Co-founder ~ http://www.noelios.com


-----Message d'origine-----
De : Fabio Mancinelli [mailto:[email protected]] 
Envoye : vendredi 13 fevrier 2009 12:01
A : [email protected]
Objet : JAX-RS and media types

Dear all,

I am playing with the Restlet JAX-RS extension and I have a question to ask 
about media types.

I defined two MessageBodyWriter for MyType, one annotated with 
@Produces("text/xml") and the other with @Produces("text/plain").

Now the problem is that when Safari asks for a resource that gives a 
representation of MyType using the following header:

Accept: 
text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5

The text/plain representation is returned.

Actually the returned representation varies randomly at each server restart. 
Sometimes the text/xml is returned. I suspect that this
is due by the fact that providers are put in a Set returned by the getClasses() 
method, where the order is not taken into account.

Anyway I would have expected that with such an Accept header, the text/xml 
would have always been returned and I don't understand
why, being a text/xml writer available, the text/plain is selected.

Any idea?

Thank you,
Fabio

P.S.: If I use simpler Accept headers, everything works fine: "Accept: 
text/plain" -> returns text/plain. "Accept: text/xml" ->
returns text/xml.

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

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

Reply via email to