On Mon, Jan 02, 2006 at 09:44:11AM +0200, Pesonen, Petteri wrote: > Hi, > > I have updated to the HttpClient 3.0 and I have a questing concerning > the use of MultiThreadedHttpConnectionManager and the > method.getResponseBodyAsStream() method. > > According to the code example in threading guide > (http://jakarta.apache.org/commons/httpclient/threading.html) the stream > returned by the getResponseBodyAsStream() is not closed, but then again > the main tutorial states: > > "Call method.getResponseBodyAsStream() and read the entire contents of > the stream then call stream.close(). ..." > > So, just to be sure. The stream must always be closed even when using > the MultiThreadedHttpConnectionManager? Right? >
Petteri, It is critical that connections are _always_ released back to the connection manager when the response content has been consumed. The HttpMethod#releaseConnection() calls #close() on the input stream associated with the connection automatically. There's no harm in closing the input stream returned by #getResponseBodyAsStream() method. This will NOT close the underlying socket anyways Cheers, Oleg > > -- > Petteri :: +358-40-8619334 > > --------------------------------------------------------------------- > 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]
