Jan Bracker wrote:
 > (I assume that is what i should do if i want to close connections of
 > HttpClient). But the longer content downloaded on that connections get
 > the more time it takes to close the given connection.
 >


Please use #abort method instead.

I can't find any #abort methode within DefaultHttpClient, HttpResponse
or HttpEntity and InputStream does not support such a method either.
Are you sure you are talking about version 4.0? As said in the subject
i am using HttpComponents 4.0 beta. As looking through 3.1 javadoc i
found the requested method but it does not seem to be available within
4.0. Or am i looking at the wrong places?

I have found the ClientConnectionManager.releaseConnection method (if
that is the way a connection is closed abrupt within 4.0), but i can't
find a possibility to get the HttpRoute of my HttpResponse that i need
to identify the connection i want to close.

It's on the method, i.e., HttpPost, HttpGet, etc...

Regards,
Sebastiaan


2008/4/17, Oleg Kalnichevski <[EMAIL PROTECTED]>:
 On Thu, 2008-04-17 at 11:40 +0200, Jan Bracker wrote:
 > Hello,
 >
 > i'm using the DefaultHttpClient for downloading bigger files. When i
 > want to abort a download i call response.getEntity().consumeContent()


Why? The purpose of HttpEntity#consumeContent() method is to ensure the
 underlying connection is re-usable for subsequent requests, not to abort
 the actual request



 > (I assume that is what i should do if i want to close connections of
 > HttpClient). But the longer content downloaded on that connections get
 > the more time it takes to close the given connection.
 >


Please use #abort method instead.



 > I allready looked at source and found the problem within
 > ChunkedInputStream. consumeContent() calls close() to the InputStream
 > and that close results in a call of exhaustInputStream() and that
 > reads the complete rest of content sent by the host.
 >
 > Why is this implemented like that? Why not just close the
 > connection/stream?


To be able to use persistent connection reliably.



 >  This behaviour is very annoying when wanting to
 > stop a request that leads to a response entity of severel megabytes,
 > especially on connections that are volume payed or have a slow
 > bandwidth.
 >
 > Is there a way to close the connection (consumeContent) of my current
 > response without having to read the complete content? How do i solve
 > my problem of closing connections quick and abrupt?
 >


See above.

 Oleg

 > Greetings, Jan Bracker
 >
 > ---------------------------------------------------------------------
 > 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]



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

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature

Reply via email to