cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Peter Neu" <>
Subject AW: AW: AW: How to use cocoon servlet only for rendering documents?
Date Thu, 16 Feb 2006 10:36:36 GMT

thanks for the advice this works perfectly! As suggested only adding
streaming generator suffices to do it.

Just one last question to end the subject: When I generate the xml in my
non-cocoon apps. It looks somehow like this:

PrintWriter out = response.getWriter();
StreamResult streamResult = new StreamResult(out);
SAXTransformerFactory tf = (SAXTransformerFactory)
TransformerHandler hd = tf.newTransformerHandler();
Transformer serializer = hd.getTransformer();
serializer.setOutputProperty(OutputKeys.ENCODING, "ISO-8859-1");
serializer.setOutputProperty(OutputKeys.INDENT, "yes");
AttributesImpl atts = new AttributesImpl();
hd.startElement("", "", "Document", atts);
hd.characters("Hello Document".toCharArray(), 0, "Hello Document".length());
hd.endElement("", "", "Document");

Now in order to pass it to cocoon via the commons httpclient I need it to
be a File Input Stream e.g. a file object. 

post.setRequestEntity(new InputStreamRequestEntity(
                new FileInputStream(input), input.length()));

But this is not a good idea because it would be then saved locally and would
create some overhead. What I need to do is keep it in memory to pass the sax
pipeline to the post call. How could I do this?


-----Ursprüngliche Nachricht-----
Von: Bertrand Delacretaz [] 
Gesendet: Mittwoch, 15. Februar 2006 17:58
Betreff: Re: AW: AW: How to use cocoon servlet only for rendering documents?

Le 15 févr. 06, à 17:49, Peter Hunsberger a écrit :

> ...Won't the request generator also
> do the trick at this point?  Or will it muck the embedded XML?..

The RequestGenerator should work if input values are passed as  
parameters (although I've never tried it with XML fragments as  

The StreamGenerator also gives access to the POST body (depending on  
the mimetype of the request, see 


View raw message