Please take a look at:
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=26070

The code attached to that bug report has been thoroughly tested and does
provide you with an OutputStream. Implement OutputStreamWriter and simply
write to the provided OutputStream. Do not close the stream.

Thanks
Moh

>-----Original Message-----
>From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
>Sent: Wednesday, March 03, 2004 4:42 PM
>To: Commons HttpClient Project
>Subject: Streaming requests
>
>
>I know there have been several discussions in regards to 
>streaming requests rather than buffering.  There have been 
>many suggestions on how to allow for streaming of requests 
>using Piped streams, etc, but I have come up against a 
>situation were it seems to be impossible to do with the 
>current architecture.  I am using JDOM to generate XML and 
>send it to the server using httpclient.  The problem I am 
>running into is that the xml can become large enough that 
>streaming would definately help on memory allocations. The 
>real stumbling block lies in the fact that JDOM expects an 
>output stream to write to and httpclient uses an input stream. 
> This would normally be a great place to use Piped streams but 
>in this instance it doesn't work.
>
>This example demonstrates the problem
>
>PipedInputStream pipedInputStream = new PipedInputStream(); 
>PipedOutputStream pipedOutputStream = new 
>PipedOutputStream(pipedInputStream);
>XMLOutputter output = new XMLOutputter();
>
>postMethod.setRequestBody(pipedInputStream);
>output.output(doc, pipedOutputStream);   // calling this outputs to the
>output stream but this hangs because the PipedInputStream is 
>not read until executeMethod int statusCode = 
>httpClient.executeMethod(postMethod);
>
>
>The problem here is that calling output of course hangs 
>because the PipedInputStream is not being read until 
>executMethod is called.  If there was access to an output 
>stream in postMethod this could be solved.  Does anyone have 
>any other ideas of how this could be accomplished?
>
>Thanks in advance for any help.
>
>
>
>---------------------------------------------------------------------
>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