users@jersey.java.net

Re: [Jersey] Matched content type from list of candidates?

From: Marc Hadley <Marc.Hadley_at_Sun.COM>
Date: Thu, 05 Mar 2009 18:44:12 -0500

On Mar 5, 2009, at 5:46 PM, Magnus Persson wrote:

> I'm having some trouble understanding how @Produces with multiple
> media types work. Fair enough, using @Produces({"text/xml",
> "application/json"}) probably has something to do with JAXB "magic",
> but what if I use @Produces({"text/plain", "application/json"})?
> Since they are quite different formats I need to know which
> candidate was selected, but can't for the world find anything
> related in the API docs. Does it tie into producers somehow?
> Clarification and/or help kindly requested :)
>
The algorithm for picking one type from the list of types is explained
in this section of the spec:

https://jsr311.dev.java.net/nonav/releases/1.0/spec/
spec3.html#x3-380003.8

Marc

>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
> For additional commands, e-mail: users-help_at_jersey.dev.java.net
>