You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hc.apache.org by ol...@apache.org on 2017/05/09 20:02:04 UTC

[38/50] httpcomponents-core git commit: HTTPCORE-460: Add factory methods to DefaultHttpClientIODispatch to handle a null SSLContext.

HTTPCORE-460: Add factory methods to DefaultHttpClientIODispatch to handle a null SSLContext.

git-svn-id: https://svn.apache.org/repos/asf/httpcomponents/httpcore/branches/4.4.x@1793918 13f79535-47bb-0310-9956-ffa450edef68


Project: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/repo
Commit: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/commit/5ca20d37
Tree: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/tree/5ca20d37
Diff: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/diff/5ca20d37

Branch: refs/heads/4.4.x
Commit: 5ca20d3784284ede5c661eeb40ac6fd0790a250e
Parents: c5295f7
Author: Gary D. Gregory <gg...@apache.org>
Authored: Thu May 4 22:41:22 2017 +0000
Committer: Gary D. Gregory <gg...@apache.org>
Committed: Thu May 4 22:41:22 2017 +0000

----------------------------------------------------------------------
 RELEASE_NOTES.txt                               |  3 ++
 .../impl/nio/DefaultHttpClientIODispatch.java   | 38 +++++++++++++++++++-
 2 files changed, 40 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/5ca20d37/RELEASE_NOTES.txt
----------------------------------------------------------------------
diff --git a/RELEASE_NOTES.txt b/RELEASE_NOTES.txt
index 46173c4..4a3ea93 100644
--- a/RELEASE_NOTES.txt
+++ b/RELEASE_NOTES.txt
@@ -9,6 +9,9 @@ Changelog
 * HTTPCORE-450: Add a Provider parameter in SSLContextBuilder.
   Contributed by lujianbo <387852424 at qq dot com>, Gary Gregory <ggregory at apache.org>
 
+* HTTPCORE-460: Add factory methods to DefaultHttpClientIODispatch to handle a null SSLContext.
+  Contributed by Gary Gregory <ggregory at apache.org>
+
 
 Release 4.4.6
 -------------------

http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/5ca20d37/httpcore-nio/src/main/java/org/apache/http/impl/nio/DefaultHttpClientIODispatch.java
----------------------------------------------------------------------
diff --git a/httpcore-nio/src/main/java/org/apache/http/impl/nio/DefaultHttpClientIODispatch.java b/httpcore-nio/src/main/java/org/apache/http/impl/nio/DefaultHttpClientIODispatch.java
index cfc0a10..44935b0 100644
--- a/httpcore-nio/src/main/java/org/apache/http/impl/nio/DefaultHttpClientIODispatch.java
+++ b/httpcore-nio/src/main/java/org/apache/http/impl/nio/DefaultHttpClientIODispatch.java
@@ -31,8 +31,8 @@ import java.io.IOException;
 
 import javax.net.ssl.SSLContext;
 
-import org.apache.http.annotation.ThreadingBehavior;
 import org.apache.http.annotation.Contract;
+import org.apache.http.annotation.ThreadingBehavior;
 import org.apache.http.config.ConnectionConfig;
 import org.apache.http.impl.nio.reactor.AbstractIODispatch;
 import org.apache.http.nio.NHttpClientEventHandler;
@@ -54,6 +54,42 @@ import org.apache.http.util.Args;
 public class DefaultHttpClientIODispatch
                     extends AbstractIODispatch<DefaultNHttpClientConnection> {
 
+    /**
+     * Creates a new instance of this class to be used for dispatching I/O event
+     * notifications to the given protocol handler.
+     *
+     * @param handler the client protocol handler.
+     * @param sslContext an SSLContext or null (for a plain text connection.)
+     * @param config a connection configuration
+     * @return a new instance
+     * @since 4.4.7
+     */
+    public static DefaultHttpClientIODispatch create(final NHttpClientEventHandler handler,
+            final SSLContext sslContext,
+            final ConnectionConfig config) {
+        return sslContext == null ? new DefaultHttpClientIODispatch(handler, config)
+                : new DefaultHttpClientIODispatch(handler, sslContext, config);
+    }
+
+    /**
+     * Creates a new instance of this class to be used for dispatching I/O event
+     * notifications to the given protocol handler.
+     *
+     * @param handler the client protocol handler.
+     * @param sslContext an SSLContext or null (for a plain text connection.)
+     * @param sslHandler customizes various aspects of the TLS/SSL protocol.
+     * @param config a connection configuration
+     * @return a new instance
+     * @since 4.4.7
+     */
+    public static DefaultHttpClientIODispatch create(final NHttpClientEventHandler handler,
+            final SSLContext sslContext,
+            final SSLSetupHandler sslHandler,
+            final ConnectionConfig config) {
+        return sslContext == null ? new DefaultHttpClientIODispatch(handler, config)
+                : new DefaultHttpClientIODispatch(handler, sslContext, sslHandler, config);
+    }
+
     private final NHttpClientEventHandler handler;
     private final NHttpConnectionFactory<DefaultNHttpClientConnection> connFactory;