Request Generator
http://xml.apache.org/http://www.apache.org/http://www.w3.org/

Main
User Documentation

Generators
Overview

Default
File Generator

Core
Directory Generator
Fragment Extractor Generator
HTML Generator
Image Directory Generator
JSP Generator
Notifying Generator
Request Generator
Script Generator
Search Generator
Server Pages Generator
Status Generator
Stream Generator
Velocity Generator

Optional
PHP Generator
XML:DB Generator
XML:DB Collection Generator

Request Generator

The request generator uses the current request to produce xml data. It converts some of the information contained in the request to structured xml.

  • Name : request
  • Class: org.apache.cocoon.generation.RequestGenerator
  • Cacheable: no.
<map:generate type="request"/>
<!-- The src attribute is optional -->

The output has the following schema. All elements have the namespace http://xml.apache.org/cocoon/requestgenerator/2.0

<?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://xml.apache.org/cocoon/requestgenerator/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>

NoteIf you want request attributes to be generated, you must specify generate-attributes parameter at generator definition or invocation in the sitemap.

<!-- 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>


Copyright © 1999-2002 The Apache Software Foundation. All Rights Reserved.