apache > cocoon
 
Font size:      

WildcardHeader-Matcher in Cocoon (2.1 legacy document)

Warning
This document was copied as is from the Cocoon 2.1 documentation, but has not yet been fully reviewed or moved to its new home.

WildcardHeaderMatcher

NAMEheader-match, referer-match
WHATThe WildcardHeaderMatcher matches a header value against a wildcard expression..
TYPEMatcher, Sitemap Component
BLOCKCore
CLASSorg.apache.cocoon.matching.WildcardHeaderMatcher
SINCECocoon 2.0
CACHEABLEnot applicable

Description

The WildcardHeaderMatcher matches a wildcard pattern against a header value of the request.

Usage

The WildcardHeaderMatcher is used to apply the same sitemap processing to a group of requested URIs. A requested URI belongs to this group iff the header value is matched by the specified pattern.

The snippet below applies to all requested URIs having a header referer value matching the wildcard pattern http://foo.bar:8080/documentation/*.html the specified pipeline processing.

The generator retrieves the xml document having extension .xml, its basename is the request URI path, stripped off the prefix page-.

Sitemap pipeline examples

The snippet below uses the WildcardHeaderMatcher for matching the referer header value.

<map:pipelines>
  <map:pipeline>
    ....
    <map:match type="referer-match" pattern=http://foo.bar:8080/documentation/*.html">
      <!-- pipeline processing generator, transformer, serializing
      <map:generator src="xdocs/{../1}.xml"/>
      <map:transformer src="stylesheet/document2html"/>
        <map:parameter name="prev" value="{1}.html"/>
      <map:transformer/>
      <map:serialize/>
    </map:match>
    ...
  </map:pipeline>
  ...
       

Sitemap component configuration example

The WildcardHeaderMatcher sitemap configuration consists of choosing a name, and specifying the src attribute of the fully qualified name of the WildcardHeaderMatcher class.

Moreover sub element name header-name specifies the name of the header. Its value is matched against the specified pattern.

<map:matchers...
  <map:matcher name="referer-match" 
    src="org.apache.cocoon.matching.WildcardHeaderMatcher"
    logger="sitemap.matcher.referer-match" 
  />
    <header-name>referer</header-name>
    ...
  </map:matcher>
...

Configuration

The WildcardHeaderMatcher is configured by the subelement header-name, specifying the name of the header attribute name.

Setup

The WildcardHeaderMatcher gets the wildcard pattern from its pattern attribute.

Effect on Object Model and Sitemap Parameters

See a detailed discussion in WildcardURIMatcher

Bugs/Caveats

The use of parameter-name instead of header-name is deprecated.

History

12-28-02: initial creation

See also

A general documentation about matchers is available at Matchers and Selectors.

For a reference of available header names see RFC 2068, especially if Cocoon's run time environment is an http servlet environment.

Comments

add your comments