Package org.springframework.http.client

Examples of org.springframework.http.client.HttpComponentsClientHttpRequestFactory$HttpDelete


        credentialsProvider.setCredentials(AuthScope.ANY,
            new UsernamePasswordCredentials(
                configuration.getTarget().getTargetCredentials().getUsername(),
                configuration.getTarget().getTargetCredentials().getPassword()));
        CloseableHttpClient httpClient = HttpClientBuilder.create().setDefaultCredentialsProvider(credentialsProvider).build();
        HttpComponentsClientHttpRequestFactory requestFactory = new HttpComponentsClientHttpRequestFactory(httpClient);
        this.xdShell.setSpringXDOperations(new SpringXDTemplate(requestFactory, configuration.getTarget().getTargetUri()));
      }
      else {
        this.xdShell.setSpringXDOperations(new SpringXDTemplate(configuration.getTarget().getTargetUri()));
      }
View Full Code Here


  @Test
  public void testSpringXDTemplate() throws Exception {
    BasicCredentialsProvider credentialsProvider = new BasicCredentialsProvider();
    credentialsProvider.setCredentials(AuthScope.ANY, new UsernamePasswordCredentials("admin", "whosThere"));
    HttpComponentsClientHttpRequestFactory requestFactory =
        new HttpComponentsClientHttpRequestFactory(HttpClientBuilder.create()
            .setDefaultCredentialsProvider(credentialsProvider)
            .setSSLSocketFactory(new SSLConnectionSocketFactory(
                new SSLContextBuilder().loadTrustMaterial(null,
                    new TrustSelfSignedStrategy())
                    .build()))
View Full Code Here

    ((SimpleClientHttpRequestFactory) jdkTemplate.getRequestFactory()).setConnectTimeout(20000);
    ((SimpleClientHttpRequestFactory) jdkTemplate.getRequestFactory()).setReadTimeout(20000);

    // 设置使用HttpClient4.0
    httpClientRestTemplate = new RestTemplate();
    httpClientRequestFactory = new HttpComponentsClientHttpRequestFactory();
    // (optional)设置20秒超时
    httpClientRequestFactory.setConnectTimeout(20000);

    httpClientRestTemplate.setRequestFactory(httpClientRequestFactory);
View Full Code Here

        return true;
    }

    @Override
    public void afterPropertiesSet() {
        final HttpComponentsClientHttpRequestFactory requestFactory;
        final int timeout = env.getProperty("http.req.timeout", Integer.class);
        if (env.getProperty("sec.auth.basic", Boolean.class)) {
            final int port = env.getProperty(getPortPropertyName(), Integer.class);
            final String host = env.getProperty(getHostPropertyName());
            requestFactory = new PreemptiveAuthHttpRequestFactory(host, port, HttpHost.DEFAULT_SCHEME_NAME);
            requestFactory.setReadTimeout(timeout);
        } else {
            requestFactory = new DigestHttpComponentsClientHttpRequestFactory() {
                {
                    setReadTimeout(timeout);
                }
View Full Code Here

    }

    @Override
    public void afterPropertiesSet() {
        final DefaultHttpClient httpClient = new DefaultHttpClient();
        final HttpComponentsClientHttpRequestFactory requestFactory;
        if (basicAuth) {
            requestFactory = new PreemptiveAuthHttpRequestFactory(host, port, HttpHost.DEFAULT_SCHEME_NAME);
            requestFactory.setReadTimeout(timeout);
        } else {
            requestFactory = new DigestHttpComponentsClientHttpRequestFactory(httpClient) {
                {
                    setReadTimeout(timeout);
                }
View Full Code Here

            new TrustSelfSignedStrategy()).build());

    HttpClient httpClient = HttpClients.custom().setSSLSocketFactory(socketFactory)
        .build();

    HttpComponentsClientHttpRequestFactory requestFactory = new HttpComponentsClientHttpRequestFactory(
        httpClient);

    assertThat(getResponse(getLocalUrl("https", "/test.txt"), requestFactory),
        equalTo("test"));
  }
View Full Code Here

            .loadKeyMaterial(keyStore, "secret".toCharArray()).build());

    HttpClient httpClient = HttpClients.custom().setSSLSocketFactory(socketFactory)
        .build();

    HttpComponentsClientHttpRequestFactory requestFactory = new HttpComponentsClientHttpRequestFactory(
        httpClient);

    assertThat(getResponse(getLocalUrl("https", "/test.txt"), requestFactory),
        equalTo("test"));
  }
View Full Code Here

            .loadKeyMaterial(keyStore, "password".toCharArray()).build());

    HttpClient httpClient = HttpClients.custom().setSSLSocketFactory(socketFactory)
        .build();

    HttpComponentsClientHttpRequestFactory requestFactory = new HttpComponentsClientHttpRequestFactory(
        httpClient);

    assertThat(getResponse(getLocalUrl("https", "/test.txt"), requestFactory),
        equalTo("test"));
  }
View Full Code Here

            new TrustSelfSignedStrategy()).build());

    HttpClient httpClient = HttpClients.custom().setSSLSocketFactory(socketFactory)
        .build();

    HttpComponentsClientHttpRequestFactory requestFactory = new HttpComponentsClientHttpRequestFactory(
        httpClient);

    getResponse(getLocalUrl("https", "/test.txt"), requestFactory);
  }
View Full Code Here

            .loadKeyMaterial(keyStore, "password".toCharArray()).build());

    HttpClient httpClient = HttpClients.custom().setSSLSocketFactory(socketFactory)
        .build();

    HttpComponentsClientHttpRequestFactory requestFactory = new HttpComponentsClientHttpRequestFactory(
        httpClient);

    assertThat(getResponse(getLocalUrl("https", "/test.txt"), requestFactory),
        equalTo("test"));
  }
View Full Code Here

TOP

Related Classes of org.springframework.http.client.HttpComponentsClientHttpRequestFactory$HttpDelete

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.