hc-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject svn commit: r159952 - jakarta/httpclient/trunk/http-common/src/java/org/apache/http/Protocol.java
Date Sun, 03 Apr 2005 18:43:49 GMT
Author: olegk
Date: Sun Apr  3 11:43:48 2005
New Revision: 159952

URL: http://svn.apache.org/viewcvs?view=rev&rev=159952
Log:
Provided NIO and old IO versions of the default protocol socket factory

Modified:
    jakarta/httpclient/trunk/http-common/src/java/org/apache/http/Protocol.java

Modified: jakarta/httpclient/trunk/http-common/src/java/org/apache/http/Protocol.java
URL: http://svn.apache.org/viewcvs/jakarta/httpclient/trunk/http-common/src/java/org/apache/http/Protocol.java?view=diff&r1=159951&r2=159952
==============================================================================
--- jakarta/httpclient/trunk/http-common/src/java/org/apache/http/Protocol.java (original)
+++ jakarta/httpclient/trunk/http-common/src/java/org/apache/http/Protocol.java Sun Apr  3
11:43:48 2005
@@ -32,7 +32,8 @@
 import java.util.HashMap;
 import java.util.Map;
 
-import org.apache.http.impl.DefaultProtocolSocketFactory;
+import org.apache.http.impl.NIOProtocolSocketFactory;
+import org.apache.http.impl.OldIOProtocolSocketFactory;
 import org.apache.http.util.LangUtils;
 
 /**
@@ -133,8 +134,14 @@
         throws IllegalStateException {
 
         if ("http".equals(id)) {
-            final Protocol http 
-                = new Protocol("http", DefaultProtocolSocketFactory.getSocketFactory(), 80);
+            // TODO: remove direct dependency on the impl classes
+            ProtocolSocketFactory socketfactory = null;
+            if (HttpRuntime.isNIOCapable()) {
+                socketfactory = NIOProtocolSocketFactory.getSocketFactory();
+            } else {
+                socketfactory = OldIOProtocolSocketFactory.getSocketFactory();
+            }
+            final Protocol http = new Protocol("http", socketfactory, 80);
             Protocol.registerProtocol("http", http);
             return http;
         }



Mime
View raw message