On Thu, 2006-02-16 at 13:12 +0100, Peter Neu wrote:
> Hello,
> 
> I have the use case that I need to stream an xml document after the sax
> transformation with httpclient's post.setRequestEntity method. 
> 
> The sax tranformstation looks like this: 
> 
> PrintWriter out = response.getWriter();
> StreamResult streamResult = new StreamResult(out);
> SAXTransformerFactory tf = (SAXTransformerFactory)
> SAXTransformerFactory.newInstance();
> TransformerHandler hd = tf.newTransformerHandler();
> Transformer serializer = hd.getTransformer();
> serializer.setOutputProperty(OutputKeys.ENCODING, "ISO-8859-1");
> serializer.setOutputProperty(OutputKeys.INDENT, "yes");
> hd.setResult(streamResult);
> AttributesImpl atts = new AttributesImpl();
> hd.startDocument();
> hd.startElement("", "", "Document", atts);
> hd.characters("Hello Document".toCharArray(), 0, "Hello Document".length());
> atts.clear();
> hd.endElement("", "", "Document");
> hd.endDocument();
> 
> Then I need to insert it to the post method:
> 
> post.setRequestEntity(new InputStreamRequestEntity(
>                 new FileInputStream(input), input.length()));
> 
> How can I do this?
> 

Pete,

Implement a custom request entity

Oleg


> Cheers,
> Pete
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to