On Wed, 2010-10-20 at 23:45 -0700, AT Pune wrote: > 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
What is wrong with just writing out the content of the file into OutputStream instance passed as a parameter to the HttpEntity#writeTo method? Oleg --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
