users@jax-rs-spec.java.net

[jax-rs-spec users] [jsr339-experts] Re: Re: Re: Re: Re: Link 'produces' and 'consumes' parameters

From: Santiago Pericas-Geertsen <Santiago.PericasGeertsen_at_oracle.com>
Date: Thu, 23 Aug 2012 09:00:06 -0400

Hi Sergey,

On Aug 22, 2012, at 5:13 PM, Sergey Beryozkin wrote:

>> Simplification of Link class:
>>
>> http://java.net/projects/jax-rs-spec/sources/git/revision/82749c50d691aaaebb4cd7897873e10af70197eb
>>
>> Convenience methods only for "type", "title" and "rel". Class no longer
>> attempts to parse multi-valued params.
>
> I wonder if MutivaluedMap should stay ? That will let Link handle extensions with multivalued parameters, even if I guess in many cases it will not be the case, but if we start seeing the cases with 'rel' having multiple values then MultivaluedMap can help, with getRel() implying in such cases something like get the first rel value, etc

 Thanks for reviewing this. The problem with multi-valued parameters is that, in general, we don't know how to parse/serialize them. We do for "rel" because it is the defined in the RFC, but not for arbitrary extensions like "produces" and "consumes". The generic mechanism of using one or more space chars as separators does not work, and this is what prompted the change.

 By using a single-valued map, we push the problem of value interpretation to the application and simplify the framework code. If we don't, we'll need a way to plug parsers/serializers for extension parameters, and that seems like over-engineering for a first cut of Link.

-- Santiago