Apache » Cocoon »

  Cocoon Core

Cocoon Core 2.2



This action makes some request details available to the sitemap via parameter substitution.

Basic information

Component typeAction
Cocoon blockcore
Java classorg.apache.cocoon.acting.RequestParamAction
Name in Sitemap


{context}      - is the context path of the servlet (usually "/cocoon")
{requestURI}   - is the requested URI without parameters
{requestQuery} - is the query string like "?param1=test" if there is one

Additionlly all request parameters can be made available for use in the sitemap.
if the parameter "parameters" is set to true.
(A variable is created for each request parameter (only if it doesn't exist)
with the same name as the parameter itself)

Default values can be set for request parameters, by including sitemap parameters
named "default.<parameter-name>".

Sitemap definition:

<map:action name="request" src="org.apache.cocoon.acting.RequestParamAction"/>

Example use:

<map:match pattern="some-resource">
  <map:act type="request">
    <map:parameter name="parameters" value="true"/>
    <map:parameter name="default.dest" value="invalid-destination.html"/>
    <map:redirect-to uri="{context}/somewhereelse/{dest}"/>

Redirection is only one example, another use:

<map:match pattern="some-resource">
  <map:act type="request">
    <map:parameter name="parameters" value="true"/>
    <map:generate src="users/menu-{id}.xml"/>
  <map:transform src="menus/personalisation.xsl"/>

etc, etc.