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

[jsr339-experts] Question about HttpHeaders.getRequestHeader

From: Sergey Beryozkin <sberyozkin_at_talend.com>
Date: Tue, 22 Jan 2013 16:47:08 +0000

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.

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"
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")?


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