Package org.apache.http.impl.client

Examples of org.apache.http.impl.client.HttpClientBuilder.build()


  public synchronized HttpClient getHttpClient() {
    if (myHttpClient == null) {
      PoolingHttpClientConnectionManager connectionManager = new PoolingHttpClientConnectionManager(5000, TimeUnit.MILLISECONDS);
      HttpClientBuilder builder = HttpClientBuilder.create();
      builder.setConnectionManager(connectionManager);
      myHttpClient = builder.build();
    }
    return myHttpClient;
  }

  /**
 
View Full Code Here


            new UsernamePasswordCredentials(config.getProxyUserName(), config.getProxyPassword()));
        builder.setDefaultCredentialsProvider(credentialsProvider);
      }
    }

    return builder.build();
  }

  protected ThreadPoolExecutor getExecutor() {
    if (executor == null) {
      executor = createExecutor(config);
View Full Code Here

        addSslSupportIfNeeded(builder,certPath);

        // TODO: Tune client if needed (e.g. add pooling factoring .....
        // But I think, that's not really required.

        return builder.build();
    }

    // Lookup a keystore and add it to the client
    private void addSslSupportIfNeeded(HttpClientBuilder builder, String certPath) throws DockerAccessException {
        if (certPath != null) {
View Full Code Here

                    new UsernamePasswordCredentials(user, password));
            builder = builder
                    .setDefaultCredentialsProvider(credsProvider);
        }

        CloseableHttpClient client = builder.build();
        try {

            String url = consoleUrl;
            if (!url.endsWith("/")) {
                url += "/";
View Full Code Here

        if (!followRedirects) {
            httpClientBuilder.disableRedirectHandling();
        }

        httpClient = httpClientBuilder.build();

        httpAsyncClient = HttpAsyncClients.custom()
                .setDefaultRequestConfig(requestConfig)
                .setMaxConnPerRoute(metadata.getMaxConnectionsPerAddress())
                .setMaxConnTotal(metadata.getMaxConnectionsTotal())
View Full Code Here

  }
 
  protected HttpClient createSingleClient() {
    HttpClientBuilder client = HttpClients.custom().setDefaultRequestConfig(config);
   
    return client.build();
  }
 
  protected void setupHeaders(HttpRequestBase requestBase, boolean addJson) {
    requestBase.addHeader(ParseConstants.HEADER_APPLICATION_ID, Parse.getApplicationId());
    requestBase.addHeader(ParseConstants.HEADER_REST_API_KEY, Parse.getRestAPIKey());
View Full Code Here

                    .build();

            HttpClientConnectionManager ccm = new BasicHttpClientConnectionManager(registry);

            builder.setConnectionManager(ccm);
            return builder.build();
        } catch (Exception ex) {
            ex.printStackTrace();
            return null;
        }
    }
View Full Code Here

            } catch (KeyManagementException e) {
                throw new ServletException(e);
            }
        }

        proxyClient = httpClientBuilder.build();
    }

    @Override
    public void destroy() {
        try {
View Full Code Here

        if (!followRedirects) {
            httpClientBuilder.disableRedirectHandling();
        }

        httpClient = httpClientBuilder.build();

        httpAsyncClient = HttpAsyncClients.custom()
                .setDefaultRequestConfig(requestConfig)
                .setMaxConnPerRoute(metadata.getMaxConnectionsPerAddress())
                .setMaxConnTotal(metadata.getMaxConnectionsTotal())
View Full Code Here

        if (!followRedirects) {
            httpClientBuilder.disableRedirectHandling();
        }

        httpClient = httpClientBuilder.build();

        httpAsyncClient = HttpAsyncClients.custom()
                .setDefaultRequestConfig(requestConfig)
                .setMaxConnPerRoute(metadata.getMaxConnectionsPerAddress())
                .setMaxConnTotal(metadata.getMaxConnectionsTotal())
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.