dev@glassfish.java.net

Re: name/value class?

From: Bill Shannon <bill.shannon_at_oracle.com>
Date: Thu, 29 Apr 2010 23:52:09 -0700

We already have MultiMap in HK2. Does the Jersey version keep the
headers in order?

For my anticipated use I don't really *need* a map, a list is fine,
but if there's a reusable map I would consider it.


Justin Wyer wrote on 04/29/2010 10:45 PM:
> Bill why not use javax.ws.rs.core.MultivaluedMap? Are the rest
> services for gfv3 provided by jersey, if so there would be an
> implementation in there and there is already a dependency inplace.
> Otherwise if you don't want to introduce a dependency, you can just
> pillage an implementation of this from one of the jaxrs projects
> (hooray for opensource) I think this is pretty much what you are
> looking for, and it used for storing HttpHeaders in anycase.
>
> On Fri, Apr 30, 2010 at 5:12 AM, Bill Shannon <bill.shannon_at_oracle.com> wrote:
>> Tim Quinn wrote on 04/29/2010 05:00 PM:
>>> On Apr 29, 2010, at 6:51 PM, Richard S. Hall wrote:
>>>
>>>> On 4/29/10 7:49 PM, Richard S. Hall wrote:
>>>>> On 4/29/10 7:44 PM, Tim Quinn wrote:
>>>>>> I don't have other nominees to fill this need from the GlassFish
>>>>>> source. (There are some name/value related classes in the deployment/dol
>>>>>> module but they are very focused on descriptor processing and might not be
>>>>>> too useful generally.)
>>>>>>
>>>>>> As I think about this, I usually encounter the need for name/value
>>>>>> pairs along with the need to collect them and iterate through
>>>>>> them...features that Map or some other collection provides. So I sometimes
>>>>>> use a HashMap (or LinkedHashMap if I need the insertion order reflected in
>>>>>> the iteration order) and then iterate through the Map's entrySet members.
>>>>> Right, I was going to say that Map.Entry is a candidate, no?
>>>> Well, I guess not, since it is only an interface... :-(
>>> Hence the AbstractMap.SimpleEntry<K,V> class!
>> Ya, uh, that's pretty far afield from what I want.
>>
>> I started by considering a Map, but each key needs to support
>> multiple values so I considered MultiMap, which I've used elsewhere,
>> but then I thought that I should probably preserve the order of the
>> headers in case it will someday matter to someone. I thought about
>> LinkedHashMap, but I needed LinkedHashMultiMap. Can you spell "overkill"?
>>
>> So, I'm back to List and I just need an entry to put in the list.
>> I guess I can be the first to use NameValue...
>>
>> The real shame is that the Servlet spec hasn't solved this problem...
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: dev-unsubscribe_at_glassfish.dev.java.net
>> For additional commands, e-mail: dev-help_at_glassfish.dev.java.net
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: dev-help_at_glassfish.dev.java.net
>