You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hc.apache.org by Sven Köhler <sk...@upb.de> on 2003/11/14 02:21:17 UTC

HttpMethodBase.releaseConnection() finished download

Hi,

it seems that releaseConnection finishes the http-download until it is 
complete. I don't want that. I'm looking for a way to close the 
HttpConnection if the download wasn't completed yet.
I'm aware that one cannot "abort" a Http-Transfer without closing the 
connection and therfor loosing it for keep-alive etc.

There doens't seem to be a way of closing the HttpConnection by using 
the HttpMethodBase-Object. What should i try next?

Thx
   Sven


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-httpclient-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-httpclient-dev-help@jakarta.apache.org


Re: HttpMethodBase.releaseConnection() finished download

Posted by Eric Johnson <er...@tibco.com>.
Sven,

I've not tried this, but if you send a "Connection: close" header on the 
request, the server should echo that on the response. If that header is 
on the response from the server, the the "releaseConnection()" function 
will (or at least it should) immediately close the connection, rather 
than consuming the remainder of the body of the response.

Hope that helps.

-Eric.

Sven Ko"hler wrote:

> Hi,
>
> it seems that releaseConnection finishes the http-download until it is 
> complete. I don't want that. I'm looking for a way to close the 
> HttpConnection if the download wasn't completed yet.
> I'm aware that one cannot "abort" a Http-Transfer without closing the 
> connection and therfor loosing it for keep-alive etc.
>
> There doens't seem to be a way of closing the HttpConnection by using 
> the HttpMethodBase-Object. What should i try next?
>
> Thx
> Sven
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: 
> commons-httpclient-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: 
> commons-httpclient-dev-help@jakarta.apache.org
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-httpclient-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-httpclient-dev-help@jakarta.apache.org


Re: HttpMethodBase.releaseConnection() finished download

Posted by Sven Köhler <sk...@upb.de>.
>> Adding the ability to abort methods is planned for the 2.1 release, 
>> but I don't think anyone has begun work on it yet.  If you come up 
>> with a good solution that you are willing to submit we would be happy 
>> to make use of it.
> 
> So what would you suggest how an abort should look like? For me, a 
> boolean paramter for the releaseConnection-method would be sufficient.
> (releaseConnection() would be a shortcut to releaseConnection(boolean) 
> than).
> 
> I need this now, so i would try to implement a patch.
´
Well, i had a short look at the source. Beside that the call to 
releaseConnection() is delegeted from one Class to another, i cannot 
find the place where the InputStream is read until EOF and i cannot 
imagine how i should avoid it.


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-httpclient-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-httpclient-dev-help@jakarta.apache.org


Re: HttpMethodBase.releaseConnection() finished download

Posted by Ortwin Glück <or...@nose.ch>.
Sven Köhler wrote:
>> Adding the ability to abort methods is planned for the 2.1 release, 
>> but I don't think anyone has begun work on it yet.  If you come up 
>> with a good solution that you are willing to submit we would be happy 
>> to make use of it.
> 
> 
> So what would you suggest how an abort should look like? For me, a 
> boolean paramter for the releaseConnection-method would be sufficient.
> (releaseConnection() would be a shortcut to releaseConnection(boolean) 
> than).
> 
> I need this now, so i would try to implement a patch.
> 

For semantic reasons I suggest an HttpMethod::abort() method. You will 
need to create a patch against CVS HEAD. Because for the 2.0 branch it 
is definitely too late for this feature.

Maybe we will even need a HttpClient::abortAll(), but then HttpClient 
would need to know all the methods it is currently executing. That is 
easy to implement however.

Odi


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-httpclient-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-httpclient-dev-help@jakarta.apache.org


Re: HttpMethodBase.releaseConnection() finished download

Posted by Sven Köhler <sk...@upb.de>.
> Adding the ability to abort methods is planned for the 2.1 release, but 
> I don't think anyone has begun work on it yet.  If you come up with a 
> good solution that you are willing to submit we would be happy to make 
> use of it.

So what would you suggest how an abort should look like? For me, a 
boolean paramter for the releaseConnection-method would be sufficient.
(releaseConnection() would be a shortcut to releaseConnection(boolean) 
than).

I need this now, so i would try to implement a patch.


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-httpclient-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-httpclient-dev-help@jakarta.apache.org


Re: HttpMethodBase.releaseConnection() finished download

Posted by Michael Becke <be...@u.washington.edu>.
Hi Sven,

The only sure way to close the connection, at least for the moment, is 
to get hold of the HttpConnection and call close() on it.  The 
following options come to mind:

  -  implement/override your own connection manager so that you have 
direct access to the connections created.
  -  extend the Method in question and override the execute() method.  
This will give the access to the connection that is being used to 
execute the method.

Adding the ability to abort methods is planned for the 2.1 release, but 
I don't think anyone has begun work on it yet.  If you come up with a 
good solution that you are willing to submit we would be happy to make 
use of it.

Thanks,

Mike

On Nov 13, 2003, at 8:21 PM, Sven Köhler wrote:

> Hi,
>
> it seems that releaseConnection finishes the http-download until it is 
> complete. I don't want that. I'm looking for a way to close the 
> HttpConnection if the download wasn't completed yet.
> I'm aware that one cannot "abort" a Http-Transfer without closing the 
> connection and therfor loosing it for keep-alive etc.
>
> There doens't seem to be a way of closing the HttpConnection by using 
> the HttpMethodBase-Object. What should i try next?
>
> Thx
>   Sven
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: 
> commons-httpclient-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: 
> commons-httpclient-dev-help@jakarta.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-httpclient-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-httpclient-dev-help@jakarta.apache.org