public class HttpClientRetrieveFileTransfer extends AbstractRetrieveFileTransfer
Modifier and Type | Field and Description |
---|---|
protected static int |
DEFAULT_CONNECTION_TIMEOUT |
protected static int |
DEFAULT_READ_TIMEOUT |
protected IFileID |
fileid |
protected static java.lang.String |
HTTP |
protected static int |
HTTP_PORT |
protected static java.lang.String |
HTTPS |
protected static int |
HTTPS_PORT |
protected int |
httpVersion |
protected static int |
MAX_RETRY |
protected JREProxyHelper |
proxyHelper |
protected static java.lang.String[] |
supportedProtocols |
buff_length, bytesReceived, CLOSE_TIMEOUT, closeOutputStream, connectContext, DEFAULT_BUF_LENGTH, done, downloadRateBytesPerSecond, exception, fileLength, job, jobLock, lastModifiedTime, listener, localFileContents, options, paused, POLLING_RETRY_ATTEMPTS, proxy, rangeSpecification, READ_TIMEOUT, remoteFileContents, remoteFileID, remoteFileURL, responseHeaders, TIMEOUT_INPUTSTREAM_BUFFER_SIZE, transferStartTime
Constructor and Description |
---|
HttpClientRetrieveFileTransfer(org.apache.http.impl.client.DefaultHttpClient httpClient) |
Modifier and Type | Method and Description |
---|---|
void |
cancel()
Cancel this file transfer.
|
protected void |
clearProxy()
This method will clear out the proxy information (so that if this is
reused for a request without a proxy, it will work correctly).
|
protected void |
connectUsingJob(FileTransferJob cjob) |
protected java.lang.String |
createConnectJobName() |
static org.apache.http.auth.NTCredentials |
createNTLMCredentials(Proxy p) |
protected boolean |
doPause()
Subclass overridable version of
AbstractRetrieveFileTransfer.pause() . |
protected boolean |
doResume()
Subclass overridable version of
AbstractRetrieveFileTransfer.resume() . |
protected void |
finalize() |
protected void |
fireConnectStartEvent() |
protected void |
fireReceiveResumedEvent() |
protected void |
fireTransferReceiveDataEvent() |
protected void |
fireTransferReceiveDoneEvent() |
protected void |
fireTransferReceivePausedEvent() |
java.lang.Object |
getAdapter(java.lang.Class adapter) |
protected int |
getConnectTimeout() |
protected org.apache.http.auth.Credentials |
getFileRequestCredentials() |
protected static java.lang.String |
getHostFromURL(java.lang.String url) |
ID |
getID()
Return the ID for this 'identifiable' object.
|
protected static java.lang.String |
getNTLMDomainName(Proxy p) |
protected static java.lang.String |
getNTLMUserName(Proxy p) |
protected static int |
getPortFromURL(java.lang.String url) |
java.lang.String |
getRemoteFileName()
Obtains the name of the remote file if possible.
|
int |
getResponseCode() |
protected void |
getResponseHeaderValues() |
protected void |
getResumeResponseHeaderValues() |
protected int |
getSocketReadTimeout() |
protected void |
hardClose() |
protected boolean |
hasForceNTLMProxyOption() |
protected boolean |
isConnected() |
protected void |
openStreams()
Open incoming and outgoing streams associated with this file transfer.
|
protected FileTransferJob |
prepareConnectJob(FileTransferJob cjob) |
protected void |
resetDoneAndException() |
void |
setConnectContextForAuthentication(IConnectContext connectContext)
Set connect context for authentication upon subsequent
IRetrieveFileTransferContainerAdapter.sendRetrieveRequest(IFileID, IFileTransferListener, Map) . |
protected void |
setInputStream(java.io.InputStream ins) |
protected void |
setRequestHeaderValues() |
protected void |
setResumeRequestHeaderValues() |
protected void |
setupAuthentication(java.lang.String urlString) |
protected void |
setupProxies() |
protected void |
setupProxy(Proxy proxy)
Setup ECF proxy.
|
static boolean |
supportsProtocol(java.lang.String protocolString) |
protected static boolean |
urlUsesHttps(java.lang.String url) |
protected java.io.InputStream |
wrapTransferReadInputStream(java.io.InputStream inputStream,
org.eclipse.core.runtime.IProgressMonitor monitor) |
createJobName, createRangeName, fireReceiveStartEvent, getBytesReceived, getException, getFileLength, getFileRangeSpecification, getFinalStatus, getListener, getOptions, getPercentComplete, getRemoteFileURL, getRemoteLastModified, getRetrieveNamespace, getSocketCloseTimeout, handleReceivedData, isCanceled, isDone, isPaused, newUserCancelledException, pause, resume, selectProxyFromProxies, sendRetrieveRequest, sendRetrieveRequest, setCloseOutputStream, setDone, setDoneCanceled, setDoneCanceled, setDoneException, setFileLength, setLastModifiedTime, setOutputStream, setProxy, setupAndScheduleJob, targetHasGzSuffix, toHumanReadableBytes
protected static final int DEFAULT_CONNECTION_TIMEOUT
protected static final int DEFAULT_READ_TIMEOUT
protected static final int HTTP_PORT
protected static final int HTTPS_PORT
protected static final int MAX_RETRY
protected static final java.lang.String HTTPS
protected static final java.lang.String HTTP
protected static final java.lang.String[] supportedProtocols
protected int httpVersion
protected IFileID fileid
protected JREProxyHelper proxyHelper
public HttpClientRetrieveFileTransfer(org.apache.http.impl.client.DefaultHttpClient httpClient)
httpClient
- http clientpublic java.lang.String getRemoteFileName()
IIncomingFileTransfer
getRemoteFileName
in interface IIncomingFileTransfer
getRemoteFileName
in class AbstractRetrieveFileTransfer
null
if no such name can be determined.public void cancel()
IFileTransfer
IFileTransferEvent
being delivered to the
IFileTransferListener
indicating that transfer is done (IFileTransfer.isDone()
returns true), and some exception will be made availablecancel
in interface IFileTransfer
cancel
in class AbstractRetrieveFileTransfer
protected void hardClose()
hardClose
in class AbstractRetrieveFileTransfer
protected org.apache.http.auth.Credentials getFileRequestCredentials() throws UnsupportedCallbackException, java.io.IOException
UnsupportedCallbackException
- if some problemjava.io.IOException
- if some problemprotected void setupProxies()
setupProxies
in class AbstractRetrieveFileTransfer
protected void resetDoneAndException()
resetDoneAndException
in class AbstractRetrieveFileTransfer
protected void setupAuthentication(java.lang.String urlString) throws UnsupportedCallbackException, java.io.IOException
UnsupportedCallbackException
java.io.IOException
protected void setRequestHeaderValues() throws InvalidFileRangeSpecificationException
public int getResponseCode()
public ID getID()
IIdentifiable
null
.getID
in interface IIdentifiable
getID
in class AbstractRetrieveFileTransfer
null
.protected void getResponseHeaderValues() throws java.io.IOException
java.io.IOException
protected void setInputStream(java.io.InputStream ins)
setInputStream
in class AbstractRetrieveFileTransfer
protected java.io.InputStream wrapTransferReadInputStream(java.io.InputStream inputStream, org.eclipse.core.runtime.IProgressMonitor monitor)
wrapTransferReadInputStream
in class AbstractRetrieveFileTransfer
protected boolean hasForceNTLMProxyOption()
protected int getSocketReadTimeout()
getSocketReadTimeout
in class AbstractRetrieveFileTransfer
protected int getConnectTimeout()
protected void openStreams() throws IncomingFileTransferException
AbstractRetrieveFileTransfer
remoteFileContents
and localFileContent
must be non-null
after successful completion of the
implementation of this method.openStreams
in class AbstractRetrieveFileTransfer
IncomingFileTransferException
- if some problempublic void setConnectContextForAuthentication(IConnectContext connectContext)
IRetrieveFileTransferContainerAdapter
IRetrieveFileTransferContainerAdapter.sendRetrieveRequest(IFileID, IFileTransferListener, Map)
. This
method should be called with a non-null connectContext in order to allow
authentication to occur during call to
IRetrieveFileTransferContainerAdapter.sendRetrieveRequest(IFileID, IFileTransferListener, Map)
.setConnectContextForAuthentication
in interface IRetrieveFileTransferContainerAdapter
setConnectContextForAuthentication
in class AbstractRetrieveFileTransfer
connectContext
- the connect context to use for authenticating during
subsequent call to
IRetrieveFileTransferContainerAdapter.sendRetrieveRequest(IFileID, IFileTransferListener, Map)
.
If null
, then no authentication will be
attempted.protected static java.lang.String getHostFromURL(java.lang.String url)
protected static int getPortFromURL(java.lang.String url)
protected static boolean urlUsesHttps(java.lang.String url)
public static boolean supportsProtocol(java.lang.String protocolString)
protected boolean isConnected()
protected boolean doPause()
AbstractRetrieveFileTransfer
AbstractRetrieveFileTransfer.pause()
. Subclasses must provide
an implementation of this method to support IFileTransferPausable
.doPause
in class AbstractRetrieveFileTransfer
false
otherwise.protected boolean doResume()
AbstractRetrieveFileTransfer
AbstractRetrieveFileTransfer.resume()
. Subclasses must
provide an implementation of this method to support
IFileTransferPausable
.doResume
in class AbstractRetrieveFileTransfer
false
otherwise.protected void setResumeRequestHeaderValues() throws java.io.IOException
java.io.IOException
protected void getResumeResponseHeaderValues() throws java.io.IOException
java.io.IOException
public java.lang.Object getAdapter(java.lang.Class adapter)
getAdapter
in interface org.eclipse.core.runtime.IAdaptable
getAdapter
in class AbstractRetrieveFileTransfer
protected void setupProxy(Proxy proxy)
AbstractRetrieveFileTransfer
AbstractRetrieveFileTransfer.sendRetrieveRequest(IFileID, IFileTransferListener, Map)
and
AbstractRetrieveFileTransfer.sendRetrieveRequest(IFileID, IFileRangeSpecification, IFileTransferListener, Map)
, prior to the actual call to AbstractRetrieveFileTransfer.openStreams()
.setupProxy
in class AbstractRetrieveFileTransfer
proxy
- the proxy to be setup. Will not be null
.protected void clearProxy()
public static org.apache.http.auth.NTCredentials createNTLMCredentials(Proxy p)
p
- proxy to create NTCredentials forprotected static java.lang.String getNTLMDomainName(Proxy p)
protected static java.lang.String getNTLMUserName(Proxy p)
protected void fireConnectStartEvent()
protected java.lang.String createConnectJobName()
protected FileTransferJob prepareConnectJob(FileTransferJob cjob)
protected void connectUsingJob(FileTransferJob cjob)
protected void finalize() throws java.lang.Throwable
finalize
in class java.lang.Object
java.lang.Throwable
protected void fireReceiveResumedEvent()
fireReceiveResumedEvent
in class AbstractRetrieveFileTransfer
protected void fireTransferReceiveDataEvent()
fireTransferReceiveDataEvent
in class AbstractRetrieveFileTransfer
protected void fireTransferReceiveDoneEvent()
fireTransferReceiveDoneEvent
in class AbstractRetrieveFileTransfer
protected void fireTransferReceivePausedEvent()
fireTransferReceivePausedEvent
in class AbstractRetrieveFileTransfer