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