disable retry handler

This commit is contained in:
Athou
2013-04-13 07:01:28 +02:00
parent 9d7c6b17c0
commit 7c5cd361da

View File

@@ -5,11 +5,11 @@ import java.io.IOException;
import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.client.ClientProtocolException;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.client.params.CookiePolicy;
import org.apache.http.client.params.HttpClientParams;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.impl.client.DefaultHttpRequestRetryHandler;
import org.apache.http.params.HttpConnectionParams;
import org.apache.http.params.HttpParams;
import org.apache.http.params.HttpProtocolParams;
@@ -25,12 +25,15 @@ public class HttpGetter {
IOException {
byte[] content = null;
HttpClient httpclient = new DefaultHttpClient();
DefaultHttpClient httpclient = new DefaultHttpClient();
HttpParams params = httpclient.getParams();
HttpClientParams.setCookiePolicy(params, CookiePolicy.IGNORE_COOKIES);
HttpProtocolParams.setContentCharset(params, "UTF-8");
HttpConnectionParams.setConnectionTimeout(params, 4000);
HttpConnectionParams.setSoTimeout(params, 4000);
httpclient
.setHttpRequestRetryHandler(new DefaultHttpRequestRetryHandler(
0, false));
try {
HttpGet httpget = new HttpGet(url);