WildcardHeader-Matcher in Cocoon
WildcardHeaderMatcher
NAME |
header-match, referer-match |
WHAT |
The WildcardHeaderMatcher matches a header value against a wildcard expression.. |
TYPE |
Matcher, Sitemap Component |
BLOCK |
Core |
CLASS |
org.apache.cocoon.matching.WildcardHeaderMatcher |
SINCE |
Cocoon 2.0 |
CACHEABLE |
not 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.
Errors and Improvements? If you see any errors or potential improvements in this document please help us: View, Edit or comment on the latest development version (registration required).