cziegeler 01/07/16 06:14:03 Modified: src/org/apache/cocoon/generation RequestGenerator.java webapp sitemap.xmap webapp/docs/samples samples.xml xdocs request-generator.xml Log: Fixed NPE in RequestGenerator and added example and some docs for it. Revision Changes Path 1.4 +2 -2 xml-cocoon2/src/org/apache/cocoon/generation/RequestGenerator.java Index: RequestGenerator.java =================================================================== RCS file: /home/cvs/xml-cocoon2/src/org/apache/cocoon/generation/RequestGenerator.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- RequestGenerator.java 2001/05/23 12:32:18 1.3 +++ RequestGenerator.java 2001/07/16 13:14:01 1.4 @@ -20,7 +20,7 @@ * @author <a href="mailto:[EMAIL PROTECTED]">Pierpaolo Fumagalli</a> * (Apache Software Foundation, Exoffice Technologies) * @author <a href="mailto:[EMAIL PROTECTED]">Giacomo Pati</a> - * @version CVS $Revision: 1.3 $ $Date: 2001/05/23 12:32:18 $ + * @version CVS $Revision: 1.4 $ $Date: 2001/07/16 13:14:01 $ */ public class RequestGenerator extends ServletGenerator implements Recyclable { @@ -39,7 +39,7 @@ AttributesImpl attr=new AttributesImpl(); this.attribute(attr,"target",request.getRequestURI()); - this.attribute(attr,"source",this.source); + this.attribute(attr,"source", (this.source != null ? this.source : "")); this.start("request",attr); this.data("\n"); this.data("\n"); 1.30 +5 -0 xml-cocoon2/webapp/sitemap.xmap Index: sitemap.xmap =================================================================== RCS file: /home/cvs/xml-cocoon2/webapp/sitemap.xmap,v retrieving revision 1.29 retrieving revision 1.30 diff -u -r1.29 -r1.30 --- sitemap.xmap 2001/07/13 20:02:12 1.29 +++ sitemap.xmap 2001/07/16 13:14:02 1.30 @@ -594,6 +594,11 @@ </map:match> <!-- ========================= Server ================================ --> + <map:match pattern="request"> + <map:generate type="request"/> + <map:serialize type="xml"/> + </map:match> + <map:match pattern="generror"> <map:generate src="docs/samples/error-giving-page.xml"/> <map:transform src="stylesheets/simple-samples2html.xsl"/> 1.9 +3 -0 xml-cocoon2/webapp/docs/samples/samples.xml Index: samples.xml =================================================================== RCS file: /home/cvs/xml-cocoon2/webapp/docs/samples/samples.xml,v retrieving revision 1.8 retrieving revision 1.9 diff -u -r1.8 -r1.9 --- samples.xml 2001/07/13 20:02:16 1.8 +++ samples.xml 2001/07/16 13:14:02 1.9 @@ -171,6 +171,9 @@ <sample name="Status Page" href="status"> Cocoon status page. </sample> + <sample name="Request Page" href="request"> + This example shows the usage of the RequestGenerator. + </sample> <sample name="Error Page" href="generror"> This example shows what happens if an error is triggered in the pipeline. </sample> 1.3 +47 -2 xml-cocoon2/xdocs/request-generator.xml Index: request-generator.xml =================================================================== RCS file: /home/cvs/xml-cocoon2/xdocs/request-generator.xml,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- request-generator.xml 2001/07/13 09:56:47 1.2 +++ request-generator.xml 2001/07/16 13:14:03 1.3 @@ -13,16 +13,61 @@ </header> <body> <s1 title="Request Generator"> - <p>????.</p> + <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: ????.</li> + <li>Cacheable: no.</li> </ul> <source> <![CDATA[ <map:generate type="request"/> + <!-- The src attribute is optional --> ]]> +</source> + <p>The output has the following schema. All elements have the namespace + <code>http://xml.apache.org/cocoon/requestgenerator/2.0</code></p>. +<source> + <![CDATA[ +<?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.cocoon2</header> + <header name="accept-encoding">gzip, deflate</header> + <header name="user-agent">Browser User Agent</header> + <header name="referer">http://thehost.serving.cocoon2/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 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> +]]> </source> </s1> </body> ---------------------------------------------------------------------- In case of troubles, e-mail: [EMAIL PROTECTED] To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]