commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rwins...@apache.org
Subject svn commit: r740961 - in /commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/ftp: FTPSClient.java FTPSServerSocketFactory.java FTPSSocketFactory.java
Date Thu, 05 Feb 2009 00:55:57 GMT
Author: rwinston
Date: Thu Feb  5 00:55:56 2009
New Revision: 740961

URL: http://svn.apache.org/viewvc?rev=740961&view=rev
Log:
NET-240 Add FTPSServerSocketFactory

Added:
    commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/ftp/FTPSServerSocketFactory.java
Modified:
    commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/ftp/FTPSClient.java
    commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/ftp/FTPSSocketFactory.java

Modified: commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/ftp/FTPSClient.java
URL: http://svn.apache.org/viewvc/commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/ftp/FTPSClient.java?rev=740961&r1=740960&r2=740961&view=diff
==============================================================================
--- commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/ftp/FTPSClient.java
(original)
+++ commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/ftp/FTPSClient.java
Thu Feb  5 00:55:56 2009
@@ -429,12 +429,9 @@
             setServerSocketFactory(null);
         } else {
             setSocketFactory(new FTPSSocketFactory(context));
-
+            setServerSocketFactory(new FTPSServerSocketFactory(context));
             initSslContext();
             
-            SSLServerSocketFactory ssf = context.getServerSocketFactory();
-
-            setServerSocketFactory(ssf);
         }
     }
 

Added: commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/ftp/FTPSServerSocketFactory.java
URL: http://svn.apache.org/viewvc/commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/ftp/FTPSServerSocketFactory.java?rev=740961&view=auto
==============================================================================
--- commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/ftp/FTPSServerSocketFactory.java
(added)
+++ commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/ftp/FTPSServerSocketFactory.java
Thu Feb  5 00:55:56 2009
@@ -0,0 +1,58 @@
+/*
+ * 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.commons.net.ftp;
+
+import java.io.BufferedReader;
+package org.apache.commons.net.ftp;
+
+import java.io.IOException;
+import java.net.InetAddress;
+import java.net.ServerSocket;
+import javax.net.ServerSocketFactory;
+import javax.net.ssl.SSLContext;
+import javax.net.ssl.SSLServerSocket;
+
+/**
+ * Server socket factory for FTPS connections.
+ */
+public class FTPSServerSocketFactory extends ServerSocketFactory {
+    
+    private SSLContext context;
+    
+    public FTPSServerSocketFactory(SSLContext context) {
+        this.context = context;
+    }
+    
+    public ServerSocket createServerSocket(int port) throws IOException {
+        return this.init(this.context.getServerSocketFactory().createServerSocket(port));
+    }
+
+    public ServerSocket createServerSocket(int port, int backlog) throws IOException {
+        return this.init(this.context.getServerSocketFactory().createServerSocket(port, backlog));
+    }
+
+    public ServerSocket createServerSocket(int port, int backlog, InetAddress ifAddress)
throws IOException {
+        return this.init(this.context.getServerSocketFactory().createServerSocket(port, backlog,
ifAddress));
+    }
+        
+    public ServerSocket init(ServerSocket socket) throws IOException {
+        ((SSLServerSocket) socket).setUseClientMode(true);
+        return socket;
+    }
+}
+

Modified: commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/ftp/FTPSSocketFactory.java
URL: http://svn.apache.org/viewvc/commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/ftp/FTPSSocketFactory.java?rev=740961&r1=740960&r2=740961&view=diff
==============================================================================
--- commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/ftp/FTPSSocketFactory.java
(original)
+++ commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/ftp/FTPSSocketFactory.java
Thu Feb  5 00:55:56 2009
@@ -15,19 +15,15 @@
  * limitations under the License.
  */
 
-
 package org.apache.commons.net.ftp;
 
 import java.io.IOException;
 import java.net.InetAddress;
-import java.net.ServerSocket;
 import java.net.Socket;
 import java.net.UnknownHostException;
 
 import javax.net.SocketFactory;
 import javax.net.ssl.SSLContext;
-import javax.net.ssl.SSLServerSocket;
-
 
 /**
  * 
@@ -37,7 +33,7 @@
  */
 public class FTPSSocketFactory extends SocketFactory {
 
-    private SSLContext context;
+    private final SSLContext context;
     
     public FTPSSocketFactory(SSLContext context) {
         this.context = context;
@@ -62,21 +58,4 @@
     public Socket createSocket(InetAddress address, int port, InetAddress localAddress, int
localPort) throws IOException {
         return this.context.getSocketFactory().createSocket(address, port, localAddress,
localPort);
     }
-    
-    public ServerSocket createServerSocket(int port) throws IOException {
-        return this.init(this.context.getServerSocketFactory().createServerSocket(port));
-    }
-
-    public ServerSocket createServerSocket(int port, int backlog) throws IOException {
-        return this.init(this.context.getServerSocketFactory().createServerSocket(port, backlog));
-    }
-
-    public ServerSocket createServerSocket(int port, int backlog, InetAddress ifAddress)
throws IOException {
-        return this.init(this.context.getServerSocketFactory().createServerSocket(port, backlog,
ifAddress));
-    }
-        
-    public ServerSocket init(ServerSocket socket) throws IOException {
-        ((SSLServerSocket) socket).setUseClientMode(true);
-        return socket;
-    }
 }



Mime
View raw message