RequestAttributeSelector
NAME | host |
WHAT | The RequestAttributeSelector component is used to
select appropriate sitemap processing depending on a request attribute
value.
|
TYPE | Selector, Sitemap Component |
BLOCK | Core |
CLASS | org.apache.cocoon.selection.RequestAttributeSelector |
SINCE | Cocoon 2.0 |
CACHEABLE | not applicable |
Description
The RequestAttributeSelector tests the value of request attribute
against the test attribute of the selector's when clause.
Usage
The RequestAttributeSelector allows to control the
sitemap processing depending on a request attribute.
Sitemap pipeline examples
The snippet below uses a RequestAttributeSelector named request-attribute .
It tests the value of request attribute named command against
list , create ; finally it has a otherwise clause.
| | |
|
<map:select type="request-attribute">
<map:parameter name="attribute-name" value="command"/>
<map:when test="list">
....
</map:when>
<map:when test="create">
...
</map:when>
...
<map:otherwise>
...
</map:otherwise>
</map:select>
| |
| | |
Sitemap component configuration example
The snippet below declares a RequestAttributeSelector
defining to use the request attribute cmd .
| | |
|
<map:selectors...
<map:selector name="request-attribute"
src="org.apache.cocoon.selection.RequestAttributeSelector"
logger="sitemap.selector.requestattribute">
<attribute-name>command</attribute-name>
</map:selectors>
...
| |
| | |
Configuration
The configuration section of RequestAttributeSelector specifies
the default name of the request attribute, used for testing.
Setup
Setting up a RequestAttributeSelector includes
-
Defining an optional sitemap paramter named
request-name , it overrides
the attribute-name setting in the configuration section.
-
choosing the
<map:when> test expressions, and a
optional <map:otherwise> clause.
The test attribute of the <map:when> clause shall match
the value of the request attribute.
If no test value matches, or the request attribute is not defined at all,
the <map:otherwise clause is selected.
Effect on Object Model and Sitemap Parameters
The RequestAttributeSelector has no side effects on the object model, or
any sitemap attributes.
Bugs/Caveats
History
28-12-02: initial creation
Copyright
Copyright (C) 1999-2002 The Apache Software Foundation. All rights reserved.
See also
A general documentation about selectors is available at
Matchers and Selectors.
|