users@jersey.java.net

Re: [Jersey] Server prioritization of media types

From: Paul Sandoz <Paul.Sandoz_at_Sun.COM>
Date: Fri, 18 Dec 2009 16:04:03 +0100

On Dec 18, 2009, at 3:49 PM, James Strachan wrote:

> 2009/12/18 Paul Sandoz <Paul.Sandoz_at_sun.com>:
>> On Dec 18, 2009, at 3:21 PM, James Strachan wrote:
>>> The only other thought I have right now is, I generally dislike
>>> annotations with arrays in them; as you can't use constants
>>> (probably
>>> due to arrays not being immutable). The various produces/consumes
>>> annotations can often end up being not very DRY as you have to cut n
>>> paste the usual suspects of MIME types all over the place. So I'd
>>> like
>>> to be able to use a single String parameter for @Produces,
>>> @Consumes,
>>> @ImplicitProduces,
>>
>> Good point. We fixed that for JAX-RS 1.1, you logged the issue :-)
>
> Yeah I know :) Just wanted to make sure we're consistent allowing a
> single String for all the related MIME type annotations
>

OK!


>
>> https://jsr311.dev.java.net/nonav/releases/1.1/javax/ws/rs/Produces.html
>> #value%28%29
>>
>> @ImplicitProduces has the same semantics.
>>
>>
>>
>>> @ProducesOrder - so folks can use a couple of
>>> constant String values across all their code (as there's likely to
>>> be
>>> only a fairly small set of values of these things in any app).
>>>
>>
>> OK, are your fine with the proposed syntax?
>
> Yes, looks good to me!
>
> I guess its not possible to use a ">" token instead of "," when
> passing multiple MIME types as a single String with @Produces? Was
> just wondering if ordering could be combined into @Produces such as
> @Produces("text/html > text/xml") etc. If its not easily possible then
> for sure the @ProducesOrder sounds good to me
>

I was wondering that too. Let me think about it.

Paul.