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

[jsr339-experts] Re: Question about HttpHeaders.getRequestHeader

From: Julian Reschke <julian.reschke_at_gmx.de>
Date: Tue, 22 Jan 2013 17:55:06 +0100

On 2013-01-22 17:47, Sergey Beryozkin 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.
>
> 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")?
> ...

You can't split on "," unless you exactly know the ABNF of the header field.

Best regards, Julian