From 6f70eca1702a0a8d938522e920a982ada52fd3eb Mon Sep 17 00:00:00 2001 From: Michael Osipov Date: Sun, 1 Mar 2015 20:11:00 +0000 Subject: [PATCH] HTTPCLIENT-1622: Name of HttpClientBuilder#setSslcontext inconsistent with the rest of SSL-related methods Method names are now uniformly SSLContext, variable names in camelcase. git-svn-id: https://svn.apache.org/repos/asf/httpcomponents/httpclient/trunk@1663155 13f79535-47bb-0310-9956-ffa450edef68 --- .../http/impl/client/HttpClientBuilder.java | 25 +++++++++++++++---- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/httpclient/src/main/java/org/apache/http/impl/client/HttpClientBuilder.java b/httpclient/src/main/java/org/apache/http/impl/client/HttpClientBuilder.java index d997c100b..23cdf0a7e 100644 --- a/httpclient/src/main/java/org/apache/http/impl/client/HttpClientBuilder.java +++ b/httpclient/src/main/java/org/apache/http/impl/client/HttpClientBuilder.java @@ -164,7 +164,7 @@ public class HttpClientBuilder { private HttpRequestExecutor requestExec; private HostnameVerifier hostnameVerifier; private LayeredConnectionSocketFactory sslSocketFactory; - private SSLContext sslcontext; + private SSLContext sslContext; private HttpClientConnectionManager connManager; private boolean connManagerShared; private SchemePortResolver schemePortResolver; @@ -288,9 +288,24 @@ public class HttpClientBuilder { * org.apache.http.conn.HttpClientConnectionManager)} and the {@link #setSSLSocketFactory( * org.apache.http.conn.socket.LayeredConnectionSocketFactory)} methods. *

+ * + * @deprecated (4.5) use {@link #setSSLContext(SSLContext)} */ - public final HttpClientBuilder setSslcontext(final SSLContext sslcontext) { - this.sslcontext = sslcontext; + @Deprecated + public final HttpClientBuilder setSslContext(final SSLContext sslcontext) { + return setSSLContext(sslcontext); + } + + /** + * Assigns {@link SSLContext} instance. + *

+ * Please note this value can be overridden by the {@link #setConnectionManager( + * org.apache.http.conn.HttpClientConnectionManager)} and the {@link #setSSLSocketFactory( + * org.apache.http.conn.socket.LayeredConnectionSocketFactory)} methods. + *

+ */ + public final HttpClientBuilder setSSLContext(final SSLContext sslContext) { + this.sslContext = sslContext; return this; } @@ -930,9 +945,9 @@ public class HttpClientBuilder { if (hostnameVerifierCopy == null) { hostnameVerifierCopy = new DefaultHostnameVerifier(publicSuffixMatcherCopy); } - if (sslcontext != null) { + if (sslContext != null) { sslSocketFactoryCopy = new SSLConnectionSocketFactory( - sslcontext, supportedProtocols, supportedCipherSuites, hostnameVerifierCopy); + sslContext, supportedProtocols, supportedCipherSuites, hostnameVerifierCopy); } else { if (systemProperties) { sslSocketFactoryCopy = new SSLConnectionSocketFactory(