Hi All, I'd like to write my own generator. I have written the following generator according to the documents on the Cocoon 2 site, by extending an example. I can start the generator properly, but I can not pass any parameter to it. Somehow I'd like to reach the HTTP request itself (requested URI, headers etc.) within the generator.
public class AnyName extends AbstractGenerator { /** * The only implemented method from AbstarctGenerator. * It simply generates SAX events from a string. */ public void generate() throws IOException, SAXException, ProcessingException { //This string will be feeded to the transformer pipeline as sax events String xmlText = "<doc>\nMy first Cocoon 2 generator\n"; //This object will read and parse the XML content XMLReader xmlReader = XMLReaderFactory.createXMLReader(); //super.xmlConsumer will receive the SAX events xmlReader.setContentHandler(super.xmlConsumer); String paramNames[] = parameters.getNames(); xmlText += "Number of parameters: " + paramNames.length + "\n"; xmlText += "Parameter names:\n"; for(int i = 0; i < paramNames.length; i++) xmlText += paramNames[i] + "\n"; xmlText += "Source: " + source + "\n"; xmlText += "</doc>"; //Create an InputSource from the hardcoded string InputSource src = new InputSource(new StringReader(xmlText)); //Parse the XML input and generate SAX events to the consumer xmlReader.parse(src); } } I use the following pipeline. In the generated XML I could see the parameters, and the source, but it seems that the source is null, and no parameters are passed to the generator. <map:pipeline> <map:match pattern="foo/*"> <map:act type="request"> <map:parameter name="parameters" value="true"/> <map:generate type="ist" source="{1}"/> <map:serialize type="xml"/> </map:act> </map:match> <map:handle-errors> <map:transform src="stylesheets/system/error2html.xsl"/> <map:serialize status-code="500"/> </map:handle-errors> </map:pipeline> How could I get the request data in the generator? Thanks in advance! Br, Istvan --------------------------------------------------------------------- Please check that your question has not already been answered in the FAQ before posting. <http://xml.apache.org/cocoon/faq/index.html> To unsubscribe, e-mail: <[EMAIL PROTECTED]> For additional commands, e-mail: <[EMAIL PROTECTED]>