Skip to content

Commit

Permalink
Support JVM proxy settings using Apache HttpComponents.
Browse files Browse the repository at this point in the history
Closes gh-52.
  • Loading branch information
mp911de committed Feb 5, 2017
1 parent f8409e2 commit d3af1d4
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2016 the original author or authors.
* Copyright 2016-2017 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -17,6 +17,7 @@

import java.io.IOException;
import java.io.InputStream;
import java.net.ProxySelector;
import java.security.GeneralSecurityException;
import java.security.KeyStore;
import java.security.NoSuchAlgorithmException;
Expand All @@ -39,6 +40,8 @@
import org.apache.http.conn.ssl.SSLConnectionSocketFactory;
import org.apache.http.impl.client.HttpClientBuilder;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.impl.conn.DefaultSchemePortResolver;
import org.apache.http.impl.conn.SystemDefaultRoutePlanner;

import org.springframework.core.io.Resource;
import org.springframework.http.client.ClientHttpRequestFactory;
Expand Down Expand Up @@ -213,6 +216,9 @@ static ClientHttpRequestFactory usingHttpComponents(ClientOptions options,

HttpClientBuilder httpClientBuilder = HttpClients.custom();

httpClientBuilder.setRoutePlanner(new SystemDefaultRoutePlanner(
DefaultSchemePortResolver.INSTANCE, ProxySelector.getDefault()));

if (hasSslConfiguration(sslConfiguration)) {

SSLContext sslContext = getSSLContext(sslConfiguration);
Expand Down

0 comments on commit d3af1d4

Please sign in to comment.