dev@jsr311.java.net

Re: Headers & Filters

From: Dhanji R. Prasanna <dhanji_at_gmail.com>
Date: Fri, 27 Apr 2007 11:51:09 +1000

On 4/24/07, Paul Sandoz <Paul.Sandoz_at_sun.com > wrote:
>
> Stefan Tilkov wrote:
> > I saw that the current proposal includes a way to get at HTTP headers by
> > binding them to method parameters. While this is fine, I wonder what the
> > thoughts are on generic header access?


I think this would work via method parameter too. Early on there was a bit
of talk about something like this:

@HttpMethod
public void get(
                      @Header(LANGUAGE) String lang, /* agnostic access to
specific header */
                      @Headers List<OrderedPair> headers, /* agnostic
access to all headers */
                      @MediaType MediaType, /* gnostic (typed) access to
specific header */
                       ) {
 //...
}

As an API-level abstraction I like this better than mining everything from a
"Context" or other backplane-style artifact. I think it is fine to allow
access to the headers set in the high level API (via injection) too.

>
> > I think that being able to get and set HTTP headers must be possible,
> > even for simple use cases.


Stefan, not to be pedantic but do you mean *get* request headers and *set*
response headers? Is there a case for reading (already-written) response
headers? Just curious what use cases might drive how we expose the headers.

Dhanji.