Add the hooks (no implementation yet) for BIO and NIO to share the code that is curre...
authormarkt <markt@13f79535-47bb-0310-9956-ffa450edef68>
Tue, 8 Mar 2011 14:03:20 +0000 (14:03 +0000)
committermarkt <markt@13f79535-47bb-0310-9956-ffa450edef68>
Tue, 8 Mar 2011 14:03:20 +0000 (14:03 +0000)
git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@1079360 13f79535-47bb-0310-9956-ffa450edef68

java/org/apache/tomcat/util/net/NioEndpoint.java
java/org/apache/tomcat/util/net/SSLImplementation.java
java/org/apache/tomcat/util/net/SSLUtil.java [new file with mode: 0644]
java/org/apache/tomcat/util/net/jsse/JSSEImplementation.java
java/org/apache/tomcat/util/net/jsse/JSSESocketFactory.java

index 59ee0ed..d60f04b 100644 (file)
@@ -94,6 +94,8 @@ public class NioEndpoint extends AbstractEndpoint {
      */
     protected ServerSocketChannel serverSock = null;
     
+    protected SSLUtil sslUtil = null;
+
     /**
      * use send file
      */
@@ -477,6 +479,9 @@ public class NioEndpoint extends AbstractEndpoint {
 
         // Initialize SSL if needed
         if (isSSLEnabled()) {
+            if (sslUtil == null) {
+                sslUtil = handler.getSslImplementation().getSSLUtil(this);
+            }
             // Initialize SSL
             String keystorePass = getKeystorePass();
             if (keystorePass == null) {
index a194af9..f79b39f 100644 (file)
@@ -86,4 +86,6 @@ public abstract class SSLImplementation {
     public abstract SSLSupport getSSLSupport(Socket sock);
 
     public abstract SSLSupport getSSLSupport(SSLSession session);
+
+    public abstract SSLUtil getSSLUtil(AbstractEndpoint ep);
 }
diff --git a/java/org/apache/tomcat/util/net/SSLUtil.java b/java/org/apache/tomcat/util/net/SSLUtil.java
new file mode 100644 (file)
index 0000000..04f551b
--- /dev/null
@@ -0,0 +1,21 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.tomcat.util.net;
+
+public interface SSLUtil {
+
+}
index a3cebb7..be2a5de 100644 (file)
@@ -25,6 +25,7 @@ import javax.net.ssl.SSLSocket;
 import org.apache.tomcat.util.net.AbstractEndpoint;
 import org.apache.tomcat.util.net.SSLImplementation;
 import org.apache.tomcat.util.net.SSLSupport;
+import org.apache.tomcat.util.net.SSLUtil;
 import org.apache.tomcat.util.net.ServerSocketFactory;
 
 /* JSSEImplementation:
@@ -56,4 +57,8 @@ public class JSSEImplementation extends SSLImplementation {
         return new JSSESupport(session);
     }
 
+    @Override
+    public SSLUtil getSSLUtil(AbstractEndpoint endpoint) {
+        return new JSSESocketFactory(endpoint);
+    }
 }
index 7fa6fab..449f282 100644 (file)
@@ -62,6 +62,7 @@ import javax.net.ssl.X509KeyManager;
 
 import org.apache.tomcat.util.net.AbstractEndpoint;
 import org.apache.tomcat.util.net.Constants;
+import org.apache.tomcat.util.net.SSLUtil;
 import org.apache.tomcat.util.net.ServerSocketFactory;
 import org.apache.tomcat.util.res.StringManager;
 
@@ -78,7 +79,7 @@ import org.apache.tomcat.util.res.StringManager;
  * @author Jan Luehe
  * @author Bill Barker
  */
-public class JSSESocketFactory implements ServerSocketFactory {
+public class JSSESocketFactory implements ServerSocketFactory, SSLUtil {
 
     private static final org.apache.juli.logging.Log log =
         org.apache.juli.logging.LogFactory.getLog(JSSESocketFactory.class);