users@jersey.java.net

_at_ImplicitProduces and priorities <was> Re: [Jersey] prioritising HTML representations in web applications when using implicit or explicit views

From: Paul Sandoz <Paul.Sandoz_at_Sun.COM>
Date: Wed, 04 Feb 2009 15:59:02 +0100

On Jan 28, 2009, at 11:22 AM, James Strachan wrote:

> 2009/1/28 Paul Sandoz <Paul.Sandoz_at_sun.com>:
>> On Jan 28, 2009, at 10:38 AM, James Strachan wrote:
>>
>>> 2009/1/28 Paul Sandoz <Paul.Sandoz_at_sun.com>:
>>>>
>>>> On Jan 28, 2009, at 12:47 AM, James Strachan wrote:
>>>>
>>>>> 2009/1/27 James Strachan <james.strachan_at_gmail.com>:
>>>>>>
>>>>>> Awesome stuff Paul, many thanks! Taking it for a spin now...
>>>>>
>>>>> It works like a charm! Great stuff Paul!
>>>>>
>>>>
>>>> Great. I am still not sure about the prioritization aspect of
>>>> media types
>>>> declared with @ImplicitProduces, it seems a hack that might be
>>>> hard to
>>>> remove when priorities are supported, or not be of the desirable
>>>> behavior
>>>> for some. It would be more consistent if @ImplicitProduces has
>>>> the same
>>>> order semantics as @Produces.
>>>
>>> Yeah.
>>>
>>> I wonder if we could just add support for priorities in the MIME
>>> types
>>> for now?
>>
>> For @Produces that will require more work :-) I do not have time to
>> investigate and implement in time for the 1.0.2 release with all
>> the other
>> things that need to be done.
>
> OK :)
>
> Would you have time to just support the priorities/quality for
> @ImplicitProduces for 1.02?

Contrary to my pessimism i managed to fine time.

This is now supported in the trunk, including comma separated values.

You need to specify the priority as a quality source using the "qs"
parameter name.

For example:

   @Path("/")
   @Singleton
   @ImplicitProduces("text/html;qs=5")
   @XmlRootElement
   @XmlAccessorType(XmlAccessType.FIELD)
   public class Bookstore { ... }

Paul.