One of the Matcher components

Using the Wildcard Request Parameter Matcher

The parameter matcher takes a parameter called 'parameter-name' in the map:matcher definition to work. This is the request parameter that you want to match on. For each parameter you need, add a new matcher definition, each with a different name.

For example; we want a matcher for the request

http://www.foobar.org/index.html?paramname=valueofparam

Add the wildcard-request matcher to the <map:matchers> section of the main sitemap:

<map:matchers>
        <map:matcher name="match-param-paramname"
                        src="org.apache.cocoon.matching.WildcardRequestParameterMatcher" 
                        logger="sitemap.matcher.wildcard-request">
                <parameter-name>paramname</parameter-name>
        </map:matcher>
</map:matchers>

This would match the following pipeline

<map:pipeline>
        <map:match type="match-param-paramname" pattern="**">
                <map:generate src="helloworld.xml"/>
                <map:transform src="stylesheets/helloworld.xsl">
                        <map:parameter name="paramname" value="{1}"/>
                </map:transform>
                <map:serialize type="html"/>
        </map:match>
</map:pipeline>

In this case, the value of paramname, the string 'valueofparam', is passed on to the helloworld XSL as an <xsl:parameter>.

WildcardRequestParameterMatcher (last edited 2009-09-20 23:42:48 by localhost)