Aurelien,

Are you sure I have too ? It seems that in the end HttpMethodBase
executeMethod (line 957), there's a call to release the connection used.

HttpClient changes quickly, so line 957 doesn't seem to match any more. If I assume correctly that you are referring to the function "ensureConnectionRelease", the
if (doneWithConnection) clause surrounding the release call is crucial, in that more often than not, the "doneWithConnection" flag is _false_. The connection will only be closed at this point if the "response" has been fully parsed. It is likely that this will only happen on certain types of requests, like the "HEAD" method, or if you override the respective HttpMethod in some interesting way.

You have numerous choices, all of which should "recycle" the connection appropriately. I think the following list misses some options, but should give you an idea - all functions are on HttpMethod.

* call getResponseBodyAsStream(), and eventually call "close" on the
returned stream, which has the effect of recycling the connection.
* getResponseBody() - calls getResponseBodyAsStream() for you, and
also calls close on the stream.
* getResponseBodyAsString() - a convenience wrapper around
getResponseBody().
* releaseConnection() - just calls close directly on the equivalent
of the result from getResponseBodyAsStream().

Hopefully this clarifies, rather than confuses!

-Eric Johnson.


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



Reply via email to