Example usage for org.apache.http.impl.client HttpClients createSystem

List of usage examples for org.apache.http.impl.client HttpClients createSystem

Introduction

In this page you can find the example usage for org.apache.http.impl.client HttpClients createSystem.

Prototype

public static CloseableHttpClient createSystem() 

Source Link

Document

Creates CloseableHttpClient instance with default configuration based on ssytem properties.

Usage

From source file:com.seleritycorp.common.base.http.client.HttpClientModule.java

@Override
protected void configure() {
    installFactory(HttpRequest.Factory.class);
    installFactory(HttpResponse.Factory.class);
    installFactory(HttpResponseStream.Factory.class);

    bind(HttpClient.class).toInstance(HttpClients.createSystem());
}

From source file:nl.mineleni.cbsviewer.jsp.JSPIntegrationTest.java

/**
 * init XMLUnit.// w  w  w .j a v a2 s .c  o  m
 * 
 * @throws Exception
 */
@BeforeClass
public static void setUpClass() throws Exception {
    // XMLUnit.setIgnoreWhitespace(false);
    // XMLUnit.setIgnoreAttributeOrder(true);
    // XMLUnit.setIgnoreComments(true);
    // XMLUnit.setIgnoreDiffBetweenTextAndCDATA(true);

    client = HttpClientBuilder.create().build();
    validatorclient = HttpClients.createSystem();
}

From source file:com.seleritycorp.context.RequestUtils.java

protected CloseableHttpClient getHttpClient() {
    return HttpClients.createSystem();
}

From source file:org.camunda.connect.httpclient.impl.AbstractHttpConnector.java

protected CloseableHttpClient createClient() {
    return HttpClients.createSystem();
}

From source file:org.fcrepo.client.FcrepoHttpClientBuilder.java

/**
 *  Build an HttpClient/* w ww .ja va  2s. c o m*/
 *
 *  @return an HttpClient
 */
public CloseableHttpClient build() {

    if (isBlank(username) || isBlank(password)) {
        return HttpClients.createSystem();
    } else {
        LOGGER.debug("Accessing fcrepo with user credentials");

        final CredentialsProvider credsProvider = new BasicCredentialsProvider();
        AuthScope scope = null;

        if (isBlank(host)) {
            scope = new AuthScope(AuthScope.ANY);
        } else {
            scope = new AuthScope(new HttpHost(host));
        }
        credsProvider.setCredentials(scope, new UsernamePasswordCredentials(username, password));
        return HttpClients.custom().setDefaultCredentialsProvider(credsProvider).useSystemProperties().build();
    }
}

From source file:com.github.ljtfreitas.restify.http.client.request.apache.httpclient.ApacheHttpClientRequestFactory.java

public ApacheHttpClientRequestFactory() {
    this(HttpClients.createSystem(), null);
}

From source file:io.apicurio.studio.fe.servlet.servlets.DownloadServlet.java

@PostConstruct
protected void postConstruct() {
    try {/*from   w w  w.  j a va 2  s  .c om*/
        if (uiConfig.isDisableHubApiTrustManager()) {
            SSLContext sslContext = SSLContexts.custom().loadTrustMaterial(null, new TrustSelfSignedStrategy())
                    .build();
            SSLConnectionSocketFactory sslsf = new SSLConnectionSocketFactory(sslContext,
                    NoopHostnameVerifier.INSTANCE);
            httpClient = HttpClients.custom().setSSLSocketFactory(sslsf).build();
        } else {
            httpClient = HttpClients.createSystem();
        }
    } catch (Exception e) {
        throw new RuntimeException(e);
    }
}

From source file:nl.mineleni.cbsviewer.servlet.gazetteer.lusclient.OpenLSClient.java

/**
 * Maakt een nieuwe instance van de LUS client. Stelt de http proxy in mits
 * deze in de omgevingsvariabelen is gedefinieerd middels
 * {@code http.proxyHost} en {@code http.proxyPort}.
 *//*  w  ww.ja va  2 s . com*/
public OpenLSClient() {
    this.client = HttpClients.createSystem();
    this.requestConfig = RequestConfig.custom().setCookieSpec(CookieSpecs.IGNORE_COOKIES).build();

    final String pHost = System.getProperty("http.proxyHost");
    int pPort = -1;
    try {
        pPort = Integer.valueOf(System.getProperty("http.proxyPort"));
    } catch (final NumberFormatException e) {
        LOGGER.debug("Geen proxy poort gedefinieerd.");
    }
    if ((null != pHost) && (pPort > 0)) {
        LOGGER.info("Instellen van proxy config: " + pHost + ":" + pPort);
        final HttpHost proxy = new HttpHost(pHost, pPort, "http");
        this.requestConfig = RequestConfig.copy(this.requestConfig).setProxy(proxy).build();
    } else {
        LOGGER.info("Er wordt geen proxy ingesteld.");
    }
    this.openLSResponseParser = new OpenLSGeocodeResponseParser();
    this.openLSReverseResponseParser = new OpenLSReverseGeocodeResponseParser();
}

From source file:com.github.ljtfreitas.restify.http.client.request.apache.httpclient.ApacheHttpClientRequestFactory.java

public ApacheHttpClientRequestFactory(RequestConfig requestConfig) {
    this(HttpClients.createSystem(), requestConfig);
}

From source file:com.github.ljtfreitas.restify.http.client.request.apache.httpclient.ApacheHttpClientRequestFactory.java

public ApacheHttpClientRequestFactory(HttpContext httpContext) {
    this(HttpClients.createSystem(), null, httpContext);
}