Hi Tim,
Jersey supports what is termed "quality of source" with the "qs" media
type parameter, for example:
@GET
@Produces("application/xml;qs=2")
public Object getAsXml()...
@GET
@Produces("text/plain")
public Object getAsText()...
@GET
@Produces("text/html;qs=3")
public Object getAsHtml()...
This means that ""text/html" will take precedence over "application/
xml" which takes precedence over "text/plain".
Further more if the accept header is say:
"application/xml, text/html;q=0.8"
or
"application/xml, text/*;q=0.8"
the "text/html" will still take precedence.
Hth,
Paul.
On Jun 15, 2010, at 8:45 PM, Tim Williams wrote:
> I'm wondering how to indicate the server preferred
> representation/Media Type when the client's */* preference hits?
> Suppose, I have something like:
>
> @GET
> @Produces("application/xml")
> public Object getAsXml()...
>
> @GET
> @Produces("text/plain")
> public Object getAsText()...
>
> @GET
> @Produces("text/html")
> public Object getAsHtml()...
>
> If a client sends Accept: */* (e.g. curl http://example.com --header
> "Accept: */*"), Jersey chooses the application/xml representation.
> How do I indicate that the server default should be text/html? It
> seems to prefer application/xml in all cases I could find.
>
> Thanks,
> --tim
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
> For additional commands, e-mail: users-help_at_jersey.dev.java.net
>