A Selector that matches HTTP headers in the request.

Here's a silly example to select on the Keep-Alive header. You don't want to do this...

...
  <map:select type="header">
    <map:parameter name="header-name" value="keep-alive"/>
    <map:when test="300">
      ...
    </map:when>
  </map:select>
...

Currently, I don't see how to do anything apart from a string-equal comparison. This makes it hard to do anything very useful with this selector. For instance, it would be cool to select on the Accept-Language header, but that's structured (a comma separated list of languages and optional quality values) and the selector doesn't know how to pull it apart.

Hence the silly example. More info welcome (and of course I'll record anything I discover).

The RequestGenerator may also be useful.


I found this proposal to add real content negotiation to Cocoon, but so far as I can tell this (nor anything like it) has not been implemented.

HeaderSelector (last edited 2009-09-20 23:40:04 by localhost)