jsr339-experts@jax-rs-spec.java.net

[jsr339-experts] Re: [jax-rs-spec users] Question about HttpHeaders.getRequestHeader

From: Marek Potociar <marek.potociar_at_oracle.com>
Date: Wed, 23 Jan 2013 14:46:27 +0100

On Jan 22, 2013, at 5:47 PM, Sergey Beryozkin <sberyozkin_at_talend.com> wrote:

> Hi
>
> Now and then I'm finding I'm not exactly sure what HttpHeaders.getRequestHeader() which returns a list of String is supposed to return for different types of headers, such that it can all be portable.

That's just for cases when multiple entries for the same header exist in a message. E.g.

Foo: a
Foo: b

>
> For example, consider these 2 headers:
>
>
> Accept: a/b,c/d
> Authorization: CustomScheme a=2,b=3,c=4
>
> What is the spec-compliant response from HttpHeaders.getRequestHeader() ? :
>
> 1. A single value list, with a single value containing "a/b,c/d" for Accept and "CustomScheme a=2,b=3,c=4"

Yes.

> 2. List with two values for Accept ("a/b", "c/d") and List with 3 or 4 values for Authorization, example ("CustomScheme a=2", "b=3", "c=4")?

No.

HTH,
Marek

>
>
> I think 1) is the one with the least of possible side-effects, but it requires user to parse the single value and kind of defeats the purpose of returning List<String>, it is also equivalent to a better suited method called getHeaderString(String).
>
> 2) fits really well for Accept and I guess also helps to parse the complex header with spaces, commas between actual parameters, this what CXF actually does by default but the recently reported issue made me doubt once again if it is actually portable or not
>
> Thanks, Sergey
>
>
>