Package org.apache.http.impl.client

Examples of org.apache.http.impl.client.DefaultHttpRequestRetryHandler


        this.log = Logger.getLogger(getClass().getName());
        RequestConfig.Builder requestConfigBuilder = RequestConfig.custom();
        requestConfigBuilder.setConnectTimeout(15 * 1000);
        requestConfigBuilder.setSocketTimeout(60 * 1000);
        clientBuilder.setDefaultRequestConfig(requestConfigBuilder.build());
        clientBuilder.setRetryHandler(new DefaultHttpRequestRetryHandler(0, false));
        setUserAgent("RouteConverter REST Client/" + System.getProperty("rest", "1.6"));
        this.method = method;
    }
View Full Code Here


      ConnRouteParams.setDefaultProxy(
          client.getParams(), new HttpHost(splits[0], Integer.parseInt(splits[1]), "http"));
    }

    // try resending the request once
    client.setHttpRequestRetryHandler(new DefaultHttpRequestRetryHandler(1, true));

    // Add hooks for gzip/deflate
    client.addRequestInterceptor(new HttpRequestInterceptor() {
      public void process(
          final org.apache.http.HttpRequest request,
          final HttpContext context) throws HttpException, IOException {
        if (!request.containsHeader("Accept-Encoding")) {
          request.addHeader("Accept-Encoding", "gzip, deflate");
        }
      }
    });
    client.addResponseInterceptor(new HttpResponseInterceptor() {
      public void process(
          final org.apache.http.HttpResponse response,
          final HttpContext context) throws HttpException, IOException {
        HttpEntity entity = response.getEntity();
        if (entity != null) {
          Header ceheader = entity.getContentEncoding();
          if (ceheader != null) {
            for (HeaderElement codec : ceheader.getElements()) {
              String codecname = codec.getName();
              if ("gzip".equalsIgnoreCase(codecname)) {
                response.setEntity(
                    new GzipDecompressingEntity(response.getEntity()));
                return;
              } else if ("deflate".equals(codecname)) {
                response.setEntity(new DeflateDecompressingEntity(response.getEntity()));
                return;
              }
            }
          }
        }
      }
    });
    client.setHttpRequestRetryHandler(new DefaultHttpRequestRetryHandler() );

    // Disable automatic storage and sending of cookies (see SHINDIG-1382)
    client.removeRequestInterceptorByClass(RequestAddCookies.class);
    client.removeResponseInterceptorByClass(ResponseProcessCookies.class);
View Full Code Here

        }

        if (configuration.getRetries() == 0) {
            httpClientBuilder.setRetryHandler(NO_RETRIES);
        } else {
            httpClientBuilder.setRetryHandler(new DefaultHttpRequestRetryHandler(configuration.getRetries(),
                    false));
        }
    }
View Full Code Here

        SchemeRegistry registry = new SchemeRegistry();
        registry.register(new Scheme("http", 80, PlainSocketFactory.getSocketFactory())); // The 80 here is... useless
        clientConnectionManager = new ThreadSafeClientConnManager(globalParams, registry);
        httpClient = new DefaultHttpClient(clientConnectionManager, globalParams);
        if(getConfiguration().getRequestRetryCount() != -1) {
          httpClient.setHttpRequestRetryHandler(new DefaultHttpRequestRetryHandler(getConfiguration().getRequestRetryCount(), false));
        }
       
        /*
        // TODO: Ugh! And it turns out that by default it doesn't even use persistent connections properly!
        @Override
View Full Code Here

    protected static WebSiteManagementClient webSiteManagementClient;

    protected static void createService() throws Exception {
        // reinitialize configuration from known state
        Configuration config = createConfiguration();
        config.setProperty(ApacheConfigurationProperties.PROPERTY_RETRY_HANDLER, new DefaultHttpRequestRetryHandler());

        // add LoggingFilter to any pipeline that is created
        Registry builder = (Registry) config.getBuilder();
        builder.alter(WebSiteManagementClient.class, Client.class, new Alteration<Client>() {
            @Override
View Full Code Here

    protected static ManagementClient managementClient;

    protected static void createService() throws Exception {
        // reinitialize configuration from known state
        Configuration config = createConfiguration();
        config.setProperty(ApacheConfigurationProperties.PROPERTY_RETRY_HANDLER, new DefaultHttpRequestRetryHandler());

        storageManagementClient = StorageManagementService.create(config);
    }
View Full Code Here

        storageManagementClient = StorageManagementService.create(config);
    }
   
    protected static void createManagementClient() throws Exception {
        Configuration config = createConfiguration();
        config.setProperty(ApacheConfigurationProperties.PROPERTY_RETRY_HANDLER, new DefaultHttpRequestRetryHandler());
        managementClient = ManagementService.create(config);
    }      
View Full Code Here

    protected static String testLocationValue = null;

    protected static void createService() throws Exception {
        // reinitialize configuration from known state
        Configuration config = createConfiguration();
        config.setProperty(ApacheConfigurationProperties.PROPERTY_RETRY_HANDLER, new DefaultHttpRequestRetryHandler());

        sqlManagementClient = SqlManagementService.create(config);
    }
View Full Code Here

        );
    }
   
    protected static void createManagementClient() throws Exception {
        Configuration config = createConfiguration();
        config.setProperty(ApacheConfigurationProperties.PROPERTY_RETRY_HANDLER, new DefaultHttpRequestRetryHandler());
        managementClient = ManagementService.create(config);
    }     
View Full Code Here

        managementClient = ManagementService.create(config);
    }

    protected static void createSchedulerManagementService() throws Exception {
        Configuration config = createConfiguration();
        config.setProperty(ApacheConfigurationProperties.PROPERTY_RETRY_HANDLER, new DefaultHttpRequestRetryHandler());
        schedulerManagementClient = SchedulerManagementService.create(config);
    }
View Full Code Here

TOP

Related Classes of org.apache.http.impl.client.DefaultHttpRequestRetryHandler

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.