hc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Kalnichevski, Oleg" <oleg.kalnichev...@bearingpoint.com>
Subject RE: How to diable Keep-Alive?
Date Mon, 09 Feb 2004 10:17:37 GMT
Sven,
You have several options:

(1) Provide a custom connection manager. You may choose to sub-class MultiThreadedHttpConnectionManager,
override releaseConnection method, and make it close the connection prior to returning it
to the connection pool.
(2) Simply send 'connection: close' request header with every request. Well-behaving web servers
_should_ respond with 'connection: close' header which will cause the HttpClient's default
connection manager implementation to drop the connection once the response body has been consumed.
The downside of this approach is that some web servers may ignore 'connection: close' directive,
leaving HttpClient's default connection manager unaware of your intentions. If you want a
bullet-proof solution and can afford no mishaps, do spend an extra effort on writing a custom
connection manager
(3) Use HTTP/1.0

HTH

Oleg

-----Original Message-----
From: Sven Köhler [mailto:skoehler@upb.de]
Sent: Friday, February 06, 2004 18:53
To: Commons HttpClient Project
Subject: How to diable Keep-Alive?


Hi,

i want to avoid, that POST-Requests reuse connections from the pool. I'm 
using the MultiThreadedHttpConnectionManager because i use one 
HttpClient-Object from different Threads.
By avoiding that POST-Request use already open HTTP-connections, i want 
to avoid problems with stale connections since i use InputStreams for 
POST-requests.

Is this possibility?

As far as i understood Ortwin in de.comp.lang.java, stale connections 
and POST-Requests and InputStreams lead to problems since a InputStream 
cannot be rewound. How does HttpClient currently try to work around that?


---------------------------------------------------------------------
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


Mime
View raw message