Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorslewis2009-02-17 19:11:16 +0000
committerslewis2009-02-17 19:11:16 +0000
commitc262f09c98921cfa6d15920c96617da31723901b (patch)
treebccd31c1dc5063f9153b2011692e4c428649653a /providers
parent5e0998f8b44fab7833f333050b537481af616580 (diff)
downloadorg.eclipse.ecf-c262f09c98921cfa6d15920c96617da31723901b.tar.gz
org.eclipse.ecf-c262f09c98921cfa6d15920c96617da31723901b.tar.xz
org.eclipse.ecf-c262f09c98921cfa6d15920c96617da31723901b.zip
Commit of patch from bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=263613
Diffstat (limited to 'providers')
-rw-r--r--providers/bundles/org.eclipse.ecf.provider.filetransfer.httpclient.ssl/src/org/eclipse/ecf/internal/provider/filetransfer/httpclient/ssl/SSLSocketFactoryModifier.java58
1 files changed, 14 insertions, 44 deletions
diff --git a/providers/bundles/org.eclipse.ecf.provider.filetransfer.httpclient.ssl/src/org/eclipse/ecf/internal/provider/filetransfer/httpclient/ssl/SSLSocketFactoryModifier.java b/providers/bundles/org.eclipse.ecf.provider.filetransfer.httpclient.ssl/src/org/eclipse/ecf/internal/provider/filetransfer/httpclient/ssl/SSLSocketFactoryModifier.java
index cd8cae5f3..2eb4a6ab4 100644
--- a/providers/bundles/org.eclipse.ecf.provider.filetransfer.httpclient.ssl/src/org/eclipse/ecf/internal/provider/filetransfer/httpclient/ssl/SSLSocketFactoryModifier.java
+++ b/providers/bundles/org.eclipse.ecf.provider.filetransfer.httpclient.ssl/src/org/eclipse/ecf/internal/provider/filetransfer/httpclient/ssl/SSLSocketFactoryModifier.java
@@ -13,68 +13,38 @@
package org.eclipse.ecf.internal.provider.filetransfer.httpclient.ssl;
import java.io.IOException;
-import java.net.*;
+import java.net.Socket;
import javax.net.ssl.SSLSocketFactory;
-import org.apache.commons.httpclient.ConnectTimeoutException;
-import org.apache.commons.httpclient.params.HttpConnectionParams;
-import org.apache.commons.httpclient.protocol.Protocol;
-import org.apache.commons.httpclient.protocol.SecureProtocolSocketFactory;
+import org.eclipse.ecf.filetransfer.events.socketfactory.INonconnectedSocketFactory;
import org.eclipse.ecf.internal.provider.filetransfer.httpclient.Activator;
import org.eclipse.ecf.internal.provider.filetransfer.httpclient.ISSLSocketFactoryModifier;
-/**
- *
- */
-public class SSLSocketFactoryModifier implements ISSLSocketFactoryModifier, SecureProtocolSocketFactory {
+public class SSLSocketFactoryModifier implements ISSLSocketFactoryModifier, INonconnectedSocketFactory {
public void dispose() {
- Protocol.unregisterProtocol("https"); //$NON-NLS-1$
- }
-
- /* (non-Javadoc)
- * @see org.apache.commons.httpclient.protocol.ProtocolSocketFactory#createSocket(java.lang.String, int)
- */
- public Socket createSocket(String host, int port) throws IOException, UnknownHostException {
- final SSLSocketFactory factory = getSSLSocketFactory();
- return factory.createSocket(host, port);
- }
-
- /* (non-Javadoc)
- * @see org.apache.commons.httpclient.protocol.ProtocolSocketFactory#createSocket(java.lang.String, int, java.net.InetAddress, int)
- */
- public Socket createSocket(String host, int port, InetAddress localAddress, int localPort) throws IOException, UnknownHostException {
- final SSLSocketFactory factory = getSSLSocketFactory();
- return factory.createSocket(host, port, localAddress, localPort);
+ // nothing to do
}
- private SSLSocketFactory getSSLSocketFactory() throws IOException {
+ public SSLSocketFactory getSSLSocketFactory() throws IOException {
final SSLSocketFactory factory = Activator.getDefault().getSSLSocketFactory();
if (factory == null)
throw new IOException("Cannot get socket factory"); //$NON-NLS-1$
return factory;
}
- public Socket createSocket(String remoteHost, int remotePort, InetAddress clientHost, int clientPort, HttpConnectionParams params) throws IOException, UnknownHostException, ConnectTimeoutException {
- final SSLSocketFactory factory = getSSLSocketFactory();
- if (params == null || params.getConnectionTimeout() == 0)
- return factory.createSocket(remoteHost, remotePort, clientHost, clientPort);
-
- final Socket socket = factory.createSocket(remoteHost, remotePort, clientHost, clientPort);
- // in httpclient, it seems like they will set the time out for you
- // socket.connect(new InetSocketAddress(remoteHost, remotePort), params.getConnectionTimeout());
- return socket;
- }
-
- public Socket createSocket(Socket socket, String host, int port, boolean autoClose) throws IOException, UnknownHostException {
- final SSLSocketFactory factory = getSSLSocketFactory();
- return factory.createSocket(socket, host, port, autoClose);
+ /* (non-Javadoc)
+ * @see org.eclipse.ecf.internal.provider.filetransfer.httpclient.ISSLSocketFactoryModifier#getNonconnnectedSocketFactory()
+ */
+ public INonconnectedSocketFactory getNonconnnectedSocketFactory() {
+ return this;
}
/* (non-Javadoc)
- * @see org.eclipse.ecf.internal.provider.filetransfer.httpclient.ISSLSocketFactoryModifier#getProtocolSocketFactory()
+ * @see org.eclipse.ecf.filetransfer.events.socketfactory.INonconnectedSocketFactory#createSocket()
*/
- public SecureProtocolSocketFactory getProtocolSocketFactory() {
- return this;
+ public Socket createSocket() throws IOException {
+ final SSLSocketFactory factory = getSSLSocketFactory();
+ return factory.createSocket();
}
}

Back to the top