Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'providers/bundles/org.eclipse.ecf.provider.filetransfer.httpclient')
-rw-r--r--providers/bundles/org.eclipse.ecf.provider.filetransfer.httpclient/.settings/org.eclipse.jdt.core.prefs4
-rw-r--r--providers/bundles/org.eclipse.ecf.provider.filetransfer.httpclient/META-INF/MANIFEST.MF2
-rw-r--r--providers/bundles/org.eclipse.ecf.provider.filetransfer.httpclient/src/org/eclipse/ecf/internal/provider/filetransfer/httpclient/ConnectingSocketMonitor.java31
-rw-r--r--providers/bundles/org.eclipse.ecf.provider.filetransfer.httpclient/src/org/eclipse/ecf/internal/provider/filetransfer/httpclient/ECFHttpClientProtocolSocketFactory.java40
-rw-r--r--providers/bundles/org.eclipse.ecf.provider.filetransfer.httpclient/src/org/eclipse/ecf/internal/provider/filetransfer/httpclient/ECFHttpClientSecureProtocolSocketFactory.java7
-rw-r--r--providers/bundles/org.eclipse.ecf.provider.filetransfer.httpclient/src/org/eclipse/ecf/provider/filetransfer/httpclient/HttpClientFileSystemBrowser.java69
-rw-r--r--providers/bundles/org.eclipse.ecf.provider.filetransfer.httpclient/src/org/eclipse/ecf/provider/filetransfer/httpclient/HttpClientRetrieveFileTransfer.java39
7 files changed, 121 insertions, 71 deletions
diff --git a/providers/bundles/org.eclipse.ecf.provider.filetransfer.httpclient/.settings/org.eclipse.jdt.core.prefs b/providers/bundles/org.eclipse.ecf.provider.filetransfer.httpclient/.settings/org.eclipse.jdt.core.prefs
index b0782b8a0..de328a642 100644
--- a/providers/bundles/org.eclipse.ecf.provider.filetransfer.httpclient/.settings/org.eclipse.jdt.core.prefs
+++ b/providers/bundles/org.eclipse.ecf.provider.filetransfer.httpclient/.settings/org.eclipse.jdt.core.prefs
@@ -1,4 +1,4 @@
-#Tue Feb 03 17:28:26 PST 2009
+#Wed Feb 18 10:10:45 PST 2009
eclipse.preferences.version=1
org.eclipse.jdt.core.builder.cleanOutputFolder=clean
org.eclipse.jdt.core.builder.duplicateResourceTask=warning
@@ -24,7 +24,7 @@ org.eclipse.jdt.core.compiler.problem.deadCode=warning
org.eclipse.jdt.core.compiler.problem.deprecation=warning
org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled
org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=enabled
-org.eclipse.jdt.core.compiler.problem.discouragedReference=error
+org.eclipse.jdt.core.compiler.problem.discouragedReference=ignore
org.eclipse.jdt.core.compiler.problem.emptyStatement=warning
org.eclipse.jdt.core.compiler.problem.enumIdentifier=warning
org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore
diff --git a/providers/bundles/org.eclipse.ecf.provider.filetransfer.httpclient/META-INF/MANIFEST.MF b/providers/bundles/org.eclipse.ecf.provider.filetransfer.httpclient/META-INF/MANIFEST.MF
index c84568f45..8038cfa05 100644
--- a/providers/bundles/org.eclipse.ecf.provider.filetransfer.httpclient/META-INF/MANIFEST.MF
+++ b/providers/bundles/org.eclipse.ecf.provider.filetransfer.httpclient/META-INF/MANIFEST.MF
@@ -22,7 +22,7 @@ Import-Package: org.apache.commons.httpclient,
org.osgi.service.log;version="1.3.0",
org.osgi.service.url;version="1.0.0",
org.osgi.util.tracker;version="1.3.2"
-Export-Package: org.eclipse.ecf.internal.provider.filetransfer.httpclient,
+Export-Package: org.eclipse.ecf.internal.provider.filetransfer.httpclient;x-internal:=true,
org.eclipse.ecf.provider.filetransfer.httpclient
Bundle-Vendor: %plugin.provider
Bundle-RequiredExecutionEnvironment: J2SE-1.4
diff --git a/providers/bundles/org.eclipse.ecf.provider.filetransfer.httpclient/src/org/eclipse/ecf/internal/provider/filetransfer/httpclient/ConnectingSocketMonitor.java b/providers/bundles/org.eclipse.ecf.provider.filetransfer.httpclient/src/org/eclipse/ecf/internal/provider/filetransfer/httpclient/ConnectingSocketMonitor.java
index 57cba54d6..39d8f5aca 100644
--- a/providers/bundles/org.eclipse.ecf.provider.filetransfer.httpclient/src/org/eclipse/ecf/internal/provider/filetransfer/httpclient/ConnectingSocketMonitor.java
+++ b/providers/bundles/org.eclipse.ecf.provider.filetransfer.httpclient/src/org/eclipse/ecf/internal/provider/filetransfer/httpclient/ConnectingSocketMonitor.java
@@ -11,39 +11,36 @@
package org.eclipse.ecf.internal.provider.filetransfer.httpclient;
-import java.io.IOException;
-import java.net.Socket;
import java.util.*;
+import org.eclipse.ecf.filetransfer.events.socket.*;
-public class ConnectingSocketMonitor implements ISocketConnectionCallback {
+public class ConnectingSocketMonitor implements ISocketListener {
- private Set connectingSockets;
+ private Map connectingSockets;
public ConnectingSocketMonitor(int initialCapacity) {
- connectingSockets = Collections.synchronizedSet(new HashSet(initialCapacity));
+ connectingSockets = Collections.synchronizedMap(new HashMap(initialCapacity));
}
public ConnectingSocketMonitor() {
- connectingSockets = Collections.synchronizedSet(new HashSet());
+ connectingSockets = Collections.synchronizedMap(new HashMap());
}
public Collection getConnectingSockets() {
- return Collections.unmodifiableCollection(connectingSockets);
+ return Collections.unmodifiableCollection(connectingSockets.keySet());
}
public void clear() {
connectingSockets.clear();
}
- public void onSocketConnected(Socket socket) {
- connectingSockets.remove(socket);
- }
-
- public void onSocketConnectionFailed(Socket socket, IOException e) {
- connectingSockets.remove(socket);
- }
-
- public void onSocketCreated(Socket socket) {
- connectingSockets.add(socket);
+ public void handleSocketEvent(ISocketEvent event) {
+ if (event instanceof ISocketCreatedEvent) {
+ connectingSockets.put(event.getFactorySocket(), event);
+ } else if (event instanceof ISocketConnectedEvent) {
+ connectingSockets.remove(event.getFactorySocket());
+ } else if (event instanceof ISocketClosedEvent) {
+ connectingSockets.remove(event.getFactorySocket());
+ }
}
}
diff --git a/providers/bundles/org.eclipse.ecf.provider.filetransfer.httpclient/src/org/eclipse/ecf/internal/provider/filetransfer/httpclient/ECFHttpClientProtocolSocketFactory.java b/providers/bundles/org.eclipse.ecf.provider.filetransfer.httpclient/src/org/eclipse/ecf/internal/provider/filetransfer/httpclient/ECFHttpClientProtocolSocketFactory.java
index 1e7dbd4f7..af0a968b8 100644
--- a/providers/bundles/org.eclipse.ecf.provider.filetransfer.httpclient/src/org/eclipse/ecf/internal/provider/filetransfer/httpclient/ECFHttpClientProtocolSocketFactory.java
+++ b/providers/bundles/org.eclipse.ecf.provider.filetransfer.httpclient/src/org/eclipse/ecf/internal/provider/filetransfer/httpclient/ECFHttpClientProtocolSocketFactory.java
@@ -16,47 +16,39 @@ import javax.net.SocketFactory;
import org.apache.commons.httpclient.params.HttpConnectionParams;
import org.apache.commons.httpclient.protocol.ProtocolSocketFactory;
import org.eclipse.core.runtime.Assert;
-import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.ecf.filetransfer.events.socket.*;
import org.eclipse.ecf.filetransfer.events.socketfactory.INonconnectedSocketFactory;
+import org.eclipse.ecf.provider.filetransfer.events.socket.SocketEventCreateUtil;
public class ECFHttpClientProtocolSocketFactory implements ProtocolSocketFactory {
- protected IAdaptable source;
+ protected ISocketEventSource source;
private INonconnectedSocketFactory unconnectedFactory;
- private ISocketConnectionCallback socketConnectCallback;
+ private ISocketListener socketConnectListener;
- private static final ISocketConnectionCallback NULL_CONNECT_CALLBACK = new ISocketConnectionCallback() {
-
- public void onSocketConnected(Socket socket) {
- //empty
- }
-
- public void onSocketConnectionFailed(Socket socket, IOException e) {
- //empty
- }
-
- public void onSocketCreated(Socket socket) {
+ private static final ISocketListener NULL_SOCKET_EVENT_LISTENER = new ISocketListener() {
+ public void handleSocketEvent(ISocketEvent event) {
//empty
}
};
- public ECFHttpClientProtocolSocketFactory(INonconnectedSocketFactory unconnectedFactory, IAdaptable source, ISocketConnectionCallback socketConnectCallback) {
+ public ECFHttpClientProtocolSocketFactory(INonconnectedSocketFactory unconnectedFactory, ISocketEventSource source, ISocketListener socketConnectListener) {
super();
Assert.isNotNull(unconnectedFactory);
Assert.isNotNull(source);
this.unconnectedFactory = unconnectedFactory;
this.source = source;
- this.socketConnectCallback = socketConnectCallback != null ? socketConnectCallback : NULL_CONNECT_CALLBACK;
+ this.socketConnectListener = socketConnectListener != null ? socketConnectListener : NULL_SOCKET_EVENT_LISTENER;
}
- public ECFHttpClientProtocolSocketFactory(final SocketFactory socketFactory, IAdaptable source, ISocketConnectionCallback socketConnectCallback) {
+ public ECFHttpClientProtocolSocketFactory(final SocketFactory socketFactory, ISocketEventSource source, ISocketListener socketConnectListener) {
this(new INonconnectedSocketFactory() {
public Socket createSocket() throws IOException {
return socketFactory.createSocket();
}
- }, source, socketConnectCallback);
+ }, source, socketConnectListener);
}
public Socket createSocket(String host, int port, InetAddress clientHost, int clientPort) throws IOException, UnknownHostException {
@@ -86,17 +78,7 @@ public class ECFHttpClientProtocolSocketFactory implements ProtocolSocketFactory
}
private Socket createSocket(final InetSocketAddress remoteInetAddress, final InetSocketAddress localInetAddress, int timeout) throws IOException {
- final Socket socket = unconnectedFactory.createSocket();
- socketConnectCallback.onSocketCreated(socket);
- try {
- socket.bind(localInetAddress);
- socket.connect(remoteInetAddress, timeout);
- } catch (IOException e) {
- socketConnectCallback.onSocketConnectionFailed(socket, e);
- throw e;
- }
- socketConnectCallback.onSocketConnected(socket);
- return socket;
+ return SocketEventCreateUtil.createSocket(socketConnectListener, source, unconnectedFactory, remoteInetAddress, localInetAddress, timeout);
}
public Socket createSocket(String host, int port) throws IOException, UnknownHostException {
diff --git a/providers/bundles/org.eclipse.ecf.provider.filetransfer.httpclient/src/org/eclipse/ecf/internal/provider/filetransfer/httpclient/ECFHttpClientSecureProtocolSocketFactory.java b/providers/bundles/org.eclipse.ecf.provider.filetransfer.httpclient/src/org/eclipse/ecf/internal/provider/filetransfer/httpclient/ECFHttpClientSecureProtocolSocketFactory.java
index ad4059548..91df235e3 100644
--- a/providers/bundles/org.eclipse.ecf.provider.filetransfer.httpclient/src/org/eclipse/ecf/internal/provider/filetransfer/httpclient/ECFHttpClientSecureProtocolSocketFactory.java
+++ b/providers/bundles/org.eclipse.ecf.provider.filetransfer.httpclient/src/org/eclipse/ecf/internal/provider/filetransfer/httpclient/ECFHttpClientSecureProtocolSocketFactory.java
@@ -15,20 +15,21 @@ import java.net.Socket;
import java.net.UnknownHostException;
import javax.net.ssl.SSLSocketFactory;
import org.apache.commons.httpclient.protocol.SecureProtocolSocketFactory;
-import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.ecf.filetransfer.events.socket.ISocketEventSource;
+import org.eclipse.ecf.filetransfer.events.socket.ISocketListener;
import org.eclipse.ecf.filetransfer.events.socketfactory.INonconnectedSocketFactory;
public final class ECFHttpClientSecureProtocolSocketFactory extends ECFHttpClientProtocolSocketFactory implements SecureProtocolSocketFactory {
private ISSLSocketFactoryModifier sslSocketFactoryModifier;
- public ECFHttpClientSecureProtocolSocketFactory(final ISSLSocketFactoryModifier sslSocketFactoryModifier, IAdaptable source, ISocketConnectionCallback socketConnectCallback) {
+ public ECFHttpClientSecureProtocolSocketFactory(final ISSLSocketFactoryModifier sslSocketFactoryModifier, ISocketEventSource source, ISocketListener socketConnectListener) {
super(new INonconnectedSocketFactory() {
public Socket createSocket() throws IOException {
return sslSocketFactoryModifier.getNonconnnectedSocketFactory().createSocket();
}
- }, source, socketConnectCallback);
+ }, source, socketConnectListener);
this.sslSocketFactoryModifier = sslSocketFactoryModifier;
}
diff --git a/providers/bundles/org.eclipse.ecf.provider.filetransfer.httpclient/src/org/eclipse/ecf/provider/filetransfer/httpclient/HttpClientFileSystemBrowser.java b/providers/bundles/org.eclipse.ecf.provider.filetransfer.httpclient/src/org/eclipse/ecf/provider/filetransfer/httpclient/HttpClientFileSystemBrowser.java
index cdf6c53cf..9eb2e0bfd 100644
--- a/providers/bundles/org.eclipse.ecf.provider.filetransfer.httpclient/src/org/eclipse/ecf/provider/filetransfer/httpclient/HttpClientFileSystemBrowser.java
+++ b/providers/bundles/org.eclipse.ecf.provider.filetransfer.httpclient/src/org/eclipse/ecf/provider/filetransfer/httpclient/HttpClientFileSystemBrowser.java
@@ -14,8 +14,8 @@ package org.eclipse.ecf.provider.filetransfer.httpclient;
import java.io.FileNotFoundException;
import java.io.IOException;
-import java.net.HttpURLConnection;
-import java.net.URL;
+import java.net.*;
+import java.util.Iterator;
import javax.security.auth.login.LoginException;
import org.apache.commons.httpclient.*;
import org.apache.commons.httpclient.auth.*;
@@ -24,11 +24,14 @@ import org.apache.commons.httpclient.util.DateUtil;
import org.eclipse.core.runtime.Assert;
import org.eclipse.ecf.core.security.*;
import org.eclipse.ecf.core.util.*;
+import org.eclipse.ecf.core.util.Proxy;
import org.eclipse.ecf.filetransfer.*;
+import org.eclipse.ecf.filetransfer.events.socket.ISocketEventSource;
import org.eclipse.ecf.filetransfer.identity.IFileID;
import org.eclipse.ecf.internal.provider.filetransfer.httpclient.*;
import org.eclipse.ecf.provider.filetransfer.browse.AbstractFileSystemBrowser;
import org.eclipse.ecf.provider.filetransfer.browse.URLRemoteFile;
+import org.eclipse.ecf.provider.filetransfer.events.socket.SocketEventSource;
import org.eclipse.ecf.provider.filetransfer.httpclient.HttpClientRetrieveFileTransfer.HostConfigHelper;
import org.eclipse.ecf.provider.filetransfer.util.JREProxyHelper;
import org.eclipse.osgi.util.NLS;
@@ -44,13 +47,15 @@ public class HttpClientFileSystemBrowser extends AbstractFileSystemBrowser {
private JREProxyHelper proxyHelper = null;
+ private ConnectingSocketMonitor connectingSockets;
+
protected String username = null;
protected String password = null;
protected HttpClient httpClient = null;
- protected HeadMethod headMethod;
+ protected volatile HeadMethod headMethod;
protected HostConfigHelper hostConfigHelper;
@@ -63,25 +68,69 @@ public class HttpClientFileSystemBrowser extends AbstractFileSystemBrowser {
Assert.isNotNull(httpClient);
this.httpClient = httpClient;
this.proxyHelper = new JREProxyHelper();
+ this.connectingSockets = new ConnectingSocketMonitor(1);
}
class HttpClientRemoteFileSystemRequest extends RemoteFileSystemRequest {
+ protected SocketEventSource socketEventSource;
+
+ HttpClientRemoteFileSystemRequest() {
+ this.socketEventSource = new SocketEventSource() {
+ public Object getAdapter(Class adapter) {
+ if (adapter == null) {
+ return null;
+ }
+ if (adapter.isInstance(this)) {
+ return this;
+ }
+ if (adapter.isInstance(HttpClientRemoteFileSystemRequest.this)) {
+ return HttpClientRemoteFileSystemRequest.this;
+ }
+ return null;
+ }
+ };
+ }
public Object getAdapter(Class adapter) {
if (adapter == null) {
return null;
}
- if (adapter.isInstance(this)) {
- return this;
- }
- return null;
+ return socketEventSource.getAdapter(adapter);
}
+ public void cancel() {
+ HttpClientFileSystemBrowser.this.cancel();
+ }
}
protected IRemoteFileSystemRequest createRemoteFileSystemRequest() {
- return super.createRemoteFileSystemRequest();
+ return new HttpClientRemoteFileSystemRequest();
+ }
+
+ protected void cancel() {
+ if (isCanceled()) {
+ return; // break job cancel recursion
+ }
+ setCanceled(getException());
+ super.cancel();
+ if (headMethod != null) {
+ if (!headMethod.isAborted()) {
+ headMethod.abort();
+ }
+ }
+ if (connectingSockets != null) {
+ // this should unblock socket connect calls, if any
+ for (Iterator iterator = connectingSockets.getConnectingSockets().iterator(); iterator.hasNext();) {
+ Socket socket = (Socket) iterator.next();
+ try {
+ socket.close();
+ } catch (IOException e) {
+ Trace.catching(Activator.PLUGIN_ID, DebugOptions.EXCEPTIONS_CATCHING, this.getClass(), "cancel", e); //$NON-NLS-1$
+ }
+ }
+ }
+
}
/* (non-Javadoc)
@@ -109,6 +158,7 @@ public class HttpClientFileSystemBrowser extends AbstractFileSystemBrowser {
long lastModified = 0;
long fileLength = -1;
+ connectingSockets.clear();
try {
Trace.trace(Activator.PLUGIN_ID, "browse=" + urlString); //$NON-NLS-1$
@@ -207,7 +257,8 @@ public class HttpClientFileSystemBrowser extends AbstractFileSystemBrowser {
private HostConfiguration getHostConfiguration() {
if (hostConfigHelper == null) {
- hostConfigHelper = new HostConfigHelper(job.getRequest(), null);
+ ISocketEventSource source = (ISocketEventSource) job.getRequest().getAdapter(ISocketEventSource.class);
+ hostConfigHelper = new HostConfigHelper(source, connectingSockets);
}
return hostConfigHelper.getHostConfiguration();
}
diff --git a/providers/bundles/org.eclipse.ecf.provider.filetransfer.httpclient/src/org/eclipse/ecf/provider/filetransfer/httpclient/HttpClientRetrieveFileTransfer.java b/providers/bundles/org.eclipse.ecf.provider.filetransfer.httpclient/src/org/eclipse/ecf/provider/filetransfer/httpclient/HttpClientRetrieveFileTransfer.java
index ccb15cb74..01f33de63 100644
--- a/providers/bundles/org.eclipse.ecf.provider.filetransfer.httpclient/src/org/eclipse/ecf/provider/filetransfer/httpclient/HttpClientRetrieveFileTransfer.java
+++ b/providers/bundles/org.eclipse.ecf.provider.filetransfer.httpclient/src/org/eclipse/ecf/provider/filetransfer/httpclient/HttpClientRetrieveFileTransfer.java
@@ -25,10 +25,14 @@ import org.eclipse.core.runtime.*;
import org.eclipse.ecf.core.identity.ID;
import org.eclipse.ecf.core.security.*;
import org.eclipse.ecf.core.util.*;
+import org.eclipse.ecf.core.util.Proxy;
import org.eclipse.ecf.filetransfer.*;
import org.eclipse.ecf.filetransfer.events.IFileTransferConnectStartEvent;
+import org.eclipse.ecf.filetransfer.events.socket.ISocketEventSource;
+import org.eclipse.ecf.filetransfer.events.socket.ISocketListener;
import org.eclipse.ecf.filetransfer.identity.IFileID;
import org.eclipse.ecf.internal.provider.filetransfer.httpclient.*;
+import org.eclipse.ecf.provider.filetransfer.events.socket.SocketEventSource;
import org.eclipse.ecf.provider.filetransfer.identity.FileTransferID;
import org.eclipse.ecf.provider.filetransfer.retrieve.AbstractRetrieveFileTransfer;
import org.eclipse.ecf.provider.filetransfer.retrieve.HttpHelper;
@@ -98,18 +102,18 @@ public class HttpClientRetrieveFileTransfer extends AbstractRetrieveFileTransfer
}
- public static final class HostConfigHelper {
- private IAdaptable source;
- private ISocketConnectionCallback socketConnectCallback;
+ static final class HostConfigHelper {
+ private ISocketEventSource source;
+ private ISocketListener socketListener;
private String targetURL;
private String targetPath;
private HostConfiguration hostConfiguration;
- public HostConfigHelper(IAdaptable source, ISocketConnectionCallback socketConnectCallback) {
+ public HostConfigHelper(ISocketEventSource source, ISocketListener socketListener) {
Assert.isNotNull(source);
this.source = source;
- this.socketConnectCallback = socketConnectCallback;
+ this.socketListener = socketListener;
hostConfiguration = new HostConfiguration();
}
@@ -128,13 +132,13 @@ public class HttpClientRetrieveFileTransfer extends AbstractRetrieveFileTransfer
if (sslSocketFactoryModifier == null) {
sslSocketFactoryModifier = new HttpClientDefaultSSLSocketFactoryModifier();
}
- SecureProtocolSocketFactory psf = new ECFHttpClientSecureProtocolSocketFactory(sslSocketFactoryModifier, source, socketConnectCallback);
+ SecureProtocolSocketFactory psf = new ECFHttpClientSecureProtocolSocketFactory(sslSocketFactoryModifier, source, socketListener);
Protocol sslProtocol = new Protocol(HttpClientRetrieveFileTransfer.HTTPS, (ProtocolSocketFactory) psf, port);
Trace.trace(Activator.PLUGIN_ID, "retrieve host=" + host + ";port=" + port); //$NON-NLS-1$ //$NON-NLS-2$
hostConfiguration.setHost(host, port, sslProtocol);
} else {
- ProtocolSocketFactory psf = new ECFHttpClientProtocolSocketFactory(SocketFactory.getDefault(), source, socketConnectCallback);
+ ProtocolSocketFactory psf = new ECFHttpClientProtocolSocketFactory(SocketFactory.getDefault(), source, socketListener);
Protocol protocol = new Protocol(HttpClientRetrieveFileTransfer.HTTP, psf, port);
Trace.trace(Activator.PLUGIN_ID, "retrieve host=" + host + ";port=" + port); //$NON-NLS-1$ //$NON-NLS-2$
hostConfiguration.setHost(host, port, protocol);
@@ -186,6 +190,7 @@ public class HttpClientRetrieveFileTransfer extends AbstractRetrieveFileTransfer
protected JREProxyHelper proxyHelper = null;
private HostConfigHelper hostConfigHelper;
+ private SocketEventSource socketEventSource;
private ConnectingSocketMonitor connectingSockets;
private FileTransferJob connectJob;
@@ -195,6 +200,18 @@ public class HttpClientRetrieveFileTransfer extends AbstractRetrieveFileTransfer
Assert.isNotNull(this.httpClient);
proxyHelper = new JREProxyHelper();
connectingSockets = new ConnectingSocketMonitor(1);
+ socketEventSource = new SocketEventSource() {
+ public Object getAdapter(Class adapter) {
+ if (adapter == null) {
+ return null;
+ }
+ if (adapter.isInstance(this)) {
+ return this;
+ }
+ return HttpClientRetrieveFileTransfer.this.getAdapter(adapter);
+ }
+
+ };
}
@@ -699,12 +716,14 @@ public class HttpClientRetrieveFileTransfer extends AbstractRetrieveFileTransfer
return null;
if (adapter.equals(IFileTransferPausable.class) && isHTTP11())
return this;
+ if (adapter.equals(ISocketEventSource.class))
+ return this.socketEventSource;
return super.getAdapter(adapter);
}
private HostConfiguration getHostConfiguration() {
if (hostConfigHelper == null) {
- hostConfigHelper = new HostConfigHelper(HttpClientRetrieveFileTransfer.this, connectingSockets);
+ hostConfigHelper = new HostConfigHelper(socketEventSource, connectingSockets);
}
return hostConfigHelper.getHostConfiguration();
}
@@ -795,7 +814,7 @@ public class HttpClientRetrieveFileTransfer extends AbstractRetrieveFileTransfer
}
protected String createConnectJobName() {
- return getRemoteFileURL().toString() + createRangeName() + ": connecting."; //$NON-NLS-1$
+ return getRemoteFileURL().toString() + createRangeName() + ": connecting.";
}
protected FileTransferJob prepareConnectJob(FileTransferJob cjob) {
@@ -823,7 +842,7 @@ public class HttpClientRetrieveFileTransfer extends AbstractRetrieveFileTransfer
// there might be more ticks in the future perhaps for
// connect socket, certificate validation, send request, authenticate,
int ticks = 1;
- monitor.beginTask(getRemoteFileURL().toString() + " Connecting", ticks); //$NON-NLS-1$
+ monitor.beginTask(getRemoteFileURL().toString() + " Connecting", ticks);
Exception ex = null;
try {
if (monitor.isCanceled())

Back to the top