jsr369-experts@servlet-spec.java.net

[jsr369-experts] Re: [servlet-spec users] Re: Re: Re: Re: Re: Re: Re: Re: Re: revised trailer proposals

From: Mark Thomas <markt_at_apache.org>
Date: Fri, 21 Apr 2017 16:32:08 +0100

On 21/04/17 00:44, Greg Wilkins wrote:
> Currently choice is between:
>
> 1. Map<String, String> - lower case keys, multiple fields merged.
> 2. TreeMap<String, String> - case insensitive, multiple fields merged.
> 3. Map<String, List<String>> - lower case keys, inconvenient
> 4. TreeMap<String, List<String>> - case insensitive, inconvenient
> 5. List<Map.Entry<String,String>> - ugly, very inconvenient
>
> 1. is simplest and probably sufficient
> 4. is most correct against the RFCs but a minor pain to use.

I disagree with the convenient / inconvenient tags above.

If a header has multiple values in the vast majority of cases the first
thing the user is going to want to do is split it up into the individual
values. I'd argue it makes more sense for the container to write that
code once than have every user write that code.

Note that option one still requires containers to merge multiple
instances of the same header into a single value. That is likely to
require as much code as constructing a List<String> of individual values.

My order of preference is:
3
1
4
2
5

Mark