Class HttpClientRetrieveFileTransfer
- java.lang.Object
- 
- org.eclipse.ecf.provider.filetransfer.retrieve.AbstractRetrieveFileTransfer
- 
- org.eclipse.ecf.provider.filetransfer.httpclient45.HttpClientRetrieveFileTransfer
 
 
- 
- All Implemented Interfaces:
- org.eclipse.core.runtime.IAdaptable,- IIdentifiable,- IFileTransfer,- IFileTransferPausable,- IIncomingFileTransfer,- IRetrieveFileTransferContainerAdapter,- IRetrieveFileTransfer
 
 public class HttpClientRetrieveFileTransfer extends AbstractRetrieveFileTransfer 
- 
- 
Field SummaryFields Modifier and Type Field Description protected IFileIDfileidprotected static StringHTTPprotected static intHTTP_PORTprotected static StringHTTPSprotected static intHTTPS_PORTprotected inthttpVersionprotected static intMAX_RETRYprotected JREProxyHelperproxyHelperprotected static String[]supportedProtocols- 
Fields inherited from class org.eclipse.ecf.provider.filetransfer.retrieve.AbstractRetrieveFileTransferbuff_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 SummaryConstructors Constructor Description HttpClientRetrieveFileTransfer(org.apache.http.impl.client.CloseableHttpClient client)
 - 
Method SummaryAll Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcancel()Cancel this file transfer.protected voidclearProxy()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 voidconnectUsingJob(FileTransferJob cjob)protected StringcreateConnectJobName()protected booleandoPause()Subclass overridable version ofAbstractRetrieveFileTransfer.pause().protected booleandoResume()Subclass overridable version ofAbstractRetrieveFileTransfer.resume().protected voidfireConnectStartEvent()protected voidfireReceiveResumedEvent()protected voidfireTransferReceiveDataEvent()protected voidfireTransferReceiveDoneEvent()protected voidfireTransferReceivePausedEvent()<T> TgetAdapter(Class<T> adapter)protected intgetConnectTimeout()protected org.apache.http.auth.CredentialsgetFileRequestCredentials()protected static StringgetHostFromURL(String url)IDgetID()Return the ID for this 'identifiable' object.protected static intgetPortFromURL(String url)StringgetRemoteFileName()Obtains the name of the remote file if possible.intgetResponseCode()protected voidgetResponseHeaderValues()protected voidgetResumeResponseHeaderValues()protected intgetSocketReadTimeout()protected voidhardClose()protected booleanisConnected()protected voidopenStreams()Open incoming and outgoing streams associated with this file transfer.protected FileTransferJobprepareConnectJob(FileTransferJob cjob)protected voidresetDoneAndException()voidsetConnectContextForAuthentication(IConnectContext connectContext)Set connect context for authentication upon subsequentIRetrieveFileTransferContainerAdapter.sendRetrieveRequest(IFileID, IFileTransferListener, Map).protected voidsetInputStream(InputStream ins)protected voidsetRequestHeaderValues()protected voidsetResumeRequestHeaderValues()protected voidsetupAuthentication(String urlString)protected voidsetupProxies()protected voidsetupProxy(Proxy proxy)Setup ECF proxy.static booleansupportsProtocol(String protocolString)protected static booleanurlUsesHttps(String url)protected InputStreamwrapTransferReadInputStream(InputStream inputStream, org.eclipse.core.runtime.IProgressMonitor monitor)- 
Methods inherited from class org.eclipse.ecf.provider.filetransfer.retrieve.AbstractRetrieveFileTransfercreateJobName, 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
 
- 
 
- 
- 
- 
Field Detail- 
HTTP_PORTprotected static final int HTTP_PORT - See Also:
- Constant Field Values
 
 - 
HTTPS_PORTprotected static final int HTTPS_PORT - See Also:
- Constant Field Values
 
 - 
MAX_RETRYprotected static final int MAX_RETRY - See Also:
- Constant Field Values
 
 - 
HTTPSprotected static final String HTTPS - See Also:
- Constant Field Values
 
 - 
HTTPprotected static final String HTTP - See Also:
- Constant Field Values
 
 - 
supportedProtocolsprotected static final String[] supportedProtocols 
 - 
httpVersionprotected int httpVersion 
 - 
fileidprotected IFileID fileid 
 - 
proxyHelperprotected JREProxyHelper proxyHelper 
 
- 
 - 
Method Detail- 
getRemoteFileNamepublic String getRemoteFileName() Description copied from interface:IIncomingFileTransferObtains the name of the remote file if possible. The name will typically but not necessarily be the same as the leaf part of the path to the remote file.- Specified by:
- getRemoteFileNamein interface- IIncomingFileTransfer
- Overrides:
- getRemoteFileNamein class- AbstractRetrieveFileTransfer
- Returns:
- The name of the remote file or nullif no such name can be determined.
 
 - 
cancelpublic void cancel() Description copied from interface:IFileTransferCancel this file transfer. If file transfer has already been completed, then this method has no effect. If the file transfer has not been completed then calling this method will result in anIFileTransferEventbeing delivered to theIFileTransferListenerindicating that transfer is done (IFileTransfer.isDone()returns true), and some exception will be made available- Specified by:
- cancelin interface- IFileTransfer
- Overrides:
- cancelin class- AbstractRetrieveFileTransfer
 
 - 
hardCloseprotected void hardClose() - Overrides:
- hardClosein class- AbstractRetrieveFileTransfer
 
 - 
getFileRequestCredentialsprotected org.apache.http.auth.Credentials getFileRequestCredentials() throws UnsupportedCallbackException, IOException- Returns:
- Credentials file request credentials
- Throws:
- UnsupportedCallbackException- if some problem
- IOException- if some problem
- Since:
- 5.0
 
 - 
setupProxiesprotected void setupProxies() - Overrides:
- setupProxiesin class- AbstractRetrieveFileTransfer
 
 - 
resetDoneAndExceptionprotected void resetDoneAndException() - Overrides:
- resetDoneAndExceptionin class- AbstractRetrieveFileTransfer
 
 - 
setupAuthenticationprotected void setupAuthentication(String urlString) throws UnsupportedCallbackException, IOException 
 - 
setRequestHeaderValuesprotected void setRequestHeaderValues() throws InvalidFileRangeSpecificationException
 - 
getResponseCodepublic int getResponseCode() 
 - 
getIDpublic ID getID() Description copied from interface:IIdentifiableReturn the ID for this 'identifiable' object. The returned ID should be unique within its namespace. May returnnull.- Specified by:
- getIDin interface- IIdentifiable
- Overrides:
- getIDin class- AbstractRetrieveFileTransfer
- Returns:
- the ID for this identifiable object.  May return null.
 
 - 
getResponseHeaderValuesprotected void getResponseHeaderValues() throws IOException- Throws:
- IOException
 
 - 
setInputStreamprotected void setInputStream(InputStream ins) - Overrides:
- setInputStreamin class- AbstractRetrieveFileTransfer
 
 - 
wrapTransferReadInputStreamprotected InputStream wrapTransferReadInputStream(InputStream inputStream, org.eclipse.core.runtime.IProgressMonitor monitor) - Overrides:
- wrapTransferReadInputStreamin class- AbstractRetrieveFileTransfer
 
 - 
getSocketReadTimeoutprotected int getSocketReadTimeout() - Overrides:
- getSocketReadTimeoutin class- AbstractRetrieveFileTransfer
 
 - 
getConnectTimeoutprotected int getConnectTimeout() - Returns:
- int connect timeout
- Since:
- 4.0
 
 - 
openStreamsprotected void openStreams() throws IncomingFileTransferExceptionDescription copied from class:AbstractRetrieveFileTransferOpen incoming and outgoing streams associated with this file transfer. Subclasses must implement this method to open input and output streams. TheremoteFileContentsandlocalFileContentmust be non-nullafter successful completion of the implementation of this method.- Specified by:
- openStreamsin class- AbstractRetrieveFileTransfer
- Throws:
- IncomingFileTransferException- if some problem
 
 - 
setConnectContextForAuthenticationpublic void setConnectContextForAuthentication(IConnectContext connectContext) Description copied from interface:IRetrieveFileTransferContainerAdapterSet connect context for authentication upon subsequentIRetrieveFileTransferContainerAdapter.sendRetrieveRequest(IFileID, IFileTransferListener, Map). This method should be called with a non-null connectContext in order to allow authentication to occur during call toIRetrieveFileTransferContainerAdapter.sendRetrieveRequest(IFileID, IFileTransferListener, Map).- Specified by:
- setConnectContextForAuthenticationin interface- IRetrieveFileTransferContainerAdapter
- Overrides:
- setConnectContextForAuthenticationin class- AbstractRetrieveFileTransfer
- Parameters:
- 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.
 
 - 
getPortFromURLprotected static int getPortFromURL(String url) 
 - 
urlUsesHttpsprotected static boolean urlUsesHttps(String url) 
 - 
supportsProtocolpublic static boolean supportsProtocol(String protocolString) 
 - 
isConnectedprotected boolean isConnected() 
 - 
doPauseprotected boolean doPause() Description copied from class:AbstractRetrieveFileTransferSubclass overridable version ofAbstractRetrieveFileTransfer.pause(). Subclasses must provide an implementation of this method to supportIFileTransferPausable.- Specified by:
- doPausein class- AbstractRetrieveFileTransfer
- Returns:
- true if the pause is successful. falseotherwise.
 
 - 
doResumeprotected boolean doResume() Description copied from class:AbstractRetrieveFileTransferSubclass overridable version ofAbstractRetrieveFileTransfer.resume(). Subclasses must provide an implementation of this method to supportIFileTransferPausable.- Specified by:
- doResumein class- AbstractRetrieveFileTransfer
- Returns:
- true if the resume is successful. falseotherwise.
 
 - 
setResumeRequestHeaderValuesprotected void setResumeRequestHeaderValues() throws IOException, InvalidFileRangeSpecificationException
 - 
getResumeResponseHeaderValuesprotected void getResumeResponseHeaderValues() throws IOException- Throws:
- IOException
 
 - 
getAdapterpublic <T> T getAdapter(Class<T> adapter) - Specified by:
- getAdapterin interface- org.eclipse.core.runtime.IAdaptable
- Overrides:
- getAdapterin class- AbstractRetrieveFileTransfer
 
 - 
setupProxyprotected void setupProxy(Proxy proxy) Description copied from class:AbstractRetrieveFileTransferSetup ECF proxy. Subclasses must override this method to do appropriate proxy setup. This method will be called from withinAbstractRetrieveFileTransfer.sendRetrieveRequest(IFileID, IFileTransferListener, Map)andAbstractRetrieveFileTransfer.sendRetrieveRequest(IFileID, IFileRangeSpecification, IFileTransferListener, Map), prior to the actual call toAbstractRetrieveFileTransfer.openStreams().- Specified by:
- setupProxyin class- AbstractRetrieveFileTransfer
- Parameters:
- proxy- the proxy to be setup. Will not be- null.
 
 - 
clearProxyprotected 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).- Since:
- 5.0
 
 - 
fireConnectStartEventprotected void fireConnectStartEvent() 
 - 
createConnectJobNameprotected String createConnectJobName() 
 - 
prepareConnectJobprotected FileTransferJob prepareConnectJob(FileTransferJob cjob) 
 - 
connectUsingJobprotected void connectUsingJob(FileTransferJob cjob) 
 - 
fireReceiveResumedEventprotected void fireReceiveResumedEvent() - Overrides:
- fireReceiveResumedEventin class- AbstractRetrieveFileTransfer
 
 - 
fireTransferReceiveDataEventprotected void fireTransferReceiveDataEvent() - Overrides:
- fireTransferReceiveDataEventin class- AbstractRetrieveFileTransfer
 
 - 
fireTransferReceiveDoneEventprotected void fireTransferReceiveDoneEvent() - Overrides:
- fireTransferReceiveDoneEventin class- AbstractRetrieveFileTransfer
 
 - 
fireTransferReceivePausedEventprotected void fireTransferReceivePausedEvent() - Overrides:
- fireTransferReceivePausedEventin class- AbstractRetrieveFileTransfer
 
 
- 
 
-