Code example for DefaultHttpClient

Methods: getParamssetHttpRequestRetryHandler

public class SimpleHttpClient { 
    private DefaultHttpClient client;
    public SimpleHttpClient() { 
        this.client = new DefaultHttpClient(new ThreadSafeClientConnManager());
        HttpParams params = client.getParams();
        HttpConnectionParams.setConnectionTimeout(params, 30000);
        HttpConnectionParams.setSoTimeout(params, 30000);
        client.setHttpRequestRetryHandler(new HttpRequestRetryHandler() {
            public boolean retryRequest(IOException e, int i, HttpContext httpContext) {
                return false; 
     * Send a HTTP GET request to the specified URL 
     * @param url     Target endpoint URL 
Stop searching for code, let great code find you!  Add Codota to your java IDE