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

From: Paul Sandoz <Paul.Sandoz_at_Sun.COM>
Date: Tue, 10 Apr 2007 15:06:06 +0200

Jerome Louvel wrote:
>>> I would suggest the following approach:
>>> public void setTags(@Context("header.Slug") List<String> tags){
>>> ...
>>> }
>> You lost me here. "Slug" is not of type list...
> Sorry, I wrongly assumed that "Slug" was a repeating header. Let's consider
> this solution for a truly repeating header instead.

Not that in the java doc of the proposal you can achieve the same thing
using the HeaderParam annotation:

   @HeaderParam("Accept") List<String> tags

The same rule also works for QueryParam and MatrixParam annotations.

Note that the list is not 'normalized' so if there was:

   Accept: text/html, text/plain
   Accept: image/gif

Then there would be two values "text/html, text/plain" and "image/gif".
Not always ideal...

Do you think normalization should be required?


> RFC2047:
>> It adds the ability to represent non-ISO8859 characters in headers.
> OK. Is it compatible with the HTTP 1.1 specification of headers?
> Best regards,
> Jerome
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:

| ? + ? = To question
    Paul Sandoz