RE: Parsing headers, was: Abstract from HTTP <was> Re: Welcome to JSR 311

From: Jerome Louvel <>
Date: Tue, 10 Apr 2007 11:24:45 +0200

Hi Paul and Julian,

> In HTTP, a header can have list type, the list values either being
> comma-separated or on additional header lines (or both). See
> <>.
> The trouble here is that in order to parse a header like that, the
> application needs to known about the syntax of the list elements. For
> instance, If-Match can have multiple ETags, and ETags can contain a
> comma. Thus, servlets frequently get this wrong. So any kind of
> assistance in parsing things like that would be great.

I would suggest the following approach:

public void setTags(@Context("header.Slug") List<String> tags){

The detection of a List of String would automatically trigger the
normalization and parsing of the Slug header(s) according to HTTP headers
parsing rules.

I'm not sure if other types of parsing (RFC2047) should be supported by
default beside the common HTTP header parsing, but I don't know what RFC2047
actually adds in this area, so I'm open on this.

Best regards,