Hi,

I upload a large file (>4GB in chunks) in a single http connection and by
opening the output stream just once. To do this I've used HttpClient 3.1 API
and have done this.

1. Extended the RequestEntity to create a chunked entity class that has the
getContentLength(), getContentType() etc methods.
2. Extended the EntityEnclosingMethod to create a PostMethod like class
"ChunkedPostMethod". And in its constructor called the setRequestEntity()
method passing the chunked entity class as parameter.
3. In the "ChunkedPostMethod", in the writeRequestBody(HttpState state,
HttpConnection conn) I get the handle of OutputStream using
conn.getRequestOutputStream(), and in the readResponseBody(HttpState state,
HttpConnection conn) I get the handle of InputStream using
conn.getResponseInputStream().

I use this "ChunkedPostMethod" to connect to the Http server. These input
stream and output stream handles I maintain until all the chunks are
transfered using these.

All this I've achieved with HttpClient3.1. But I'm not able to convert this
code to HttpComponents Client 4.1 as the equivalent of EntityEnclosingMethod
in httpclient4.0 is HttpEntityEnclosingRequestBase but that does not provide
any method (like writeRequestBody and readResponseBody) that provides the
after-connection outputstream and inputstream handles.

First of all is there any way of getting the outputstream from the http
connection in httpclient4.0? If yes then how?

Thanks in advance,
Anurag
-- 
View this message in context: 
http://old.nabble.com/How-to-get-an-output-stream-from-already-established-connection-in-HttpComponents-Client-4.0-tp30016648p30016648.html
Sent from the HttpClient-User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to