Hi all,
I'm using HttpComponents 4 and I'm getting the following error if I wait
more than 15 seconds between 2 HTTP GET requests:
org.apache.http.NoHttpResponseException: The target server failed to respond
If I use HTTPClient 3.1 then the error is not the same: Connection is
stale,closing...
With HTTPClient 3.1, there is no exception, the connection seems closed and
the application can go ahead.
I think the problem is related to "Keep-Alive" management from server-side.
What do you think about ?
What parameters could I pass to HTTPComponents 4 to have the same behavior
as HTTPClient 3.1 ?
I've tried to use the following parameters without success:
params = new BasicHttpParams();
ConnManagerParams.setMaxTotalConnections(params, 2);
HttpProtocolParams.setVersion(params, HttpVersion.HTTP_1_1);
HttpProtocolParams.setUseExpectContinue(params, false);
HttpConnectionParams.setStaleCheckingEnabled(params, true);
SchemeRegistry schemeRegistry = new SchemeRegistry();
schemeRegistry.register(new Scheme("http",
PlainSocketFactory.getSocketFactory(), 80));
schemeRegistry.register(new Scheme("https",
SSLSocketFactory.getSocketFactory(), 443));
manager = new ThreadSafeClientConnManager(params, schemeRegistry);
client = new DefaultHttpClient(manager, params);
client.setReuseStrategy(new ConnectionReuseStrategy(){
public boolean keepAlive(HttpResponse arg0, HttpContext arg1) {
return false;
}
});
Any advice would be welcome.
Derek.
--
View this message in context:
http://www.nabble.com/The-target-server-failed-to-respond---What-could-be-the-problem---tp23600284p23600284.html
Sent from the HttpClient-User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]