| <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> |
| <html> |
| <head> |
| <META http-equiv="Content-Type" content="text/html; charset=UTF-8"> |
| <title>Request Generator</title> |
| <link href="http://purl.org/DC/elements/1.0/" rel="schema.DC"> |
| <meta content="Carsten Ziegeler" name="DC.Creator"> |
| <meta content="This document describes the request generator of Cocoon." name="DC.Description"> |
| </head> |
| <body> |
| |
| <h1>Request Generator</h1> |
| |
| <p>The request generator uses the current request to produce xml data. |
| It converts some of the information contained in the request |
| to structured xml.</p> |
| |
| <ul> |
| |
| <li>Name : request</li> |
| |
| <li>Class: org.apache.cocoon.generation.RequestGenerator</li> |
| |
| <li>Cacheable: no.</li> |
| |
| </ul> |
| |
| <pre class="code"> |
| <map:generate type="request"/> |
| <!-- The src attribute is optional --> |
| </pre> |
| |
| <p>The output has the following schema. All elements have the namespace |
| <span class="codefrag">http://apache.org/cocoon/request/2.0</span> |
| </p> |
| |
| |
| <pre class="code"> |
| <?xml version="1.0" encoding="UTF-8"?> |
| |
| <!-- The root element is request. The target attribute is the |
| requested uri and the source attribute is the optional |
| source attribute of the sitemap entry for this pipeline. --> |
| <request target="/cocoon/request" source="" |
| xmlns="http://apache.org/cocoon/request/2.0"> |
| |
| <!-- First the headers: --> |
| <requestHeaders> |
| <header name="accept-language">de</header> |
| <header name="connection">Keep-Alive</header> |
| <header name="accept">image/gif, image/x-xbitmap, image/jpeg, |
| image/pjpeg, */*</header> |
| <header name="host">thehost.serving.cocoon</header> |
| <header name="accept-encoding">gzip, deflate</header> |
| <header name="user-agent">Browser User Agent</header> |
| <header name="referer">http://thehost.serving.cocoon/cocoon/welcome |
| </header> |
| </requestHeaders> |
| |
| <!-- All request parameters: --> |
| <requestParameters> |
| <!-- Create a parameter element for each parameter --> |
| <parameter name="login"> |
| <!-- Create a value element for each value --> |
| <value>test</value> |
| </parameter> |
| </requestParameters> |
| |
| <!-- All request attributes; see below the note on generate-attributes parameter. |
| (This feature is available startign with version 2.1 --> |
| <requestAttributes> |
| <!-- Create an attribute element for each attribute --> |
| <attribute name="errorMessage"> |
| <!-- Create a value element for the attribute value --> |
| <value>I was put here by an earlier action.</value> |
| </attribute> |
| </requestAttributes> |
| |
| <!-- All configuration parameters: --> |
| <configurationParameters> |
| <!-- Create a parameter element for each parameter specified |
| in the pipeline for this generator--> |
| <parameter name="test_sitemap_parameter">the value</parameter> |
| </configurationParameters> |
| |
| </request> |
| </pre> |
| |
| |
| |
| <div class="note">If you want request attributes to be generated, you must specify <span class="codefrag">generate-attributes</span> parameter at generator definition or invocation in the sitemap.</div> |
| |
| <pre class="code"> |
| <!-- This will turn on attribute generation on by default --> |
| <map:generator name="request" src="org.apache.cocoon.generation.RequestGenerator"> |
| <map:parameter name="generate-attributes" value="true"/> |
| </map:generator> |
| |
| <!-- or --> |
| |
| <!-- This will turn on attribute generation for this invocation only. --> |
| <map:match pattern="request"> |
| <map:generate type="request"> |
| <map:parameter name="generate-attributes" value="true"/> |
| </map:generate> |
| </map:match> |
| |
| |
| </pre> |
| |
| |
| </body> |
| </html> |