Class HttpTransport
- java.lang.Object
-
- jetbrains.buildServer.artifacts.impl.HttpTransport
-
- All Implemented Interfaces:
ProgressTrackingURLContentRetriever,URLContentRetriever
public class HttpTransport extends Object implements URLContentRetriever, ProgressTrackingURLContentRetriever
Author: Nikita.Skvortsov Date: 1/18/11
-
-
Field Summary
Fields Modifier and Type Field Description static StringCONNECTION_REFUSEDstatic StringILLEGAL_STATUSstatic StringILLEGAL_STATUS_CLEANUP
-
Constructor Summary
Constructors Constructor Description HttpTransport(org.apache.commons.httpclient.HttpClient client, String serverUrl, DependencyHttpHelper dependencyHttpHelper)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description StringdownloadUrlTo(String srcUrl, File target)Download artifact to given location.StringdownloadUrlTo(String srcUrl, File target, FileProgress fileDownloadProgress)Download artifact to a given location tracking downloading progress.StringgetDigest(String srcUrl)Retrieve content's digest.StringgetId()voidinterrupt()Interrupt operation.voidreleaseConnection()StringtoString()-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface jetbrains.buildServer.artifacts.URLContentRetriever
downloadCacheTo
-
-
-
-
Field Detail
-
ILLEGAL_STATUS
public static final String ILLEGAL_STATUS
- See Also:
- Constant Field Values
-
ILLEGAL_STATUS_CLEANUP
public static final String ILLEGAL_STATUS_CLEANUP
- See Also:
- Constant Field Values
-
CONNECTION_REFUSED
public static final String CONNECTION_REFUSED
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
HttpTransport
public HttpTransport(@NotNull org.apache.commons.httpclient.HttpClient client, @NotNull String serverUrl, @NotNull DependencyHttpHelper dependencyHttpHelper)
-
-
Method Detail
-
downloadUrlTo
@Nullable public String downloadUrlTo(@NotNull String srcUrl, @NotNull File target) throws IOException
Description copied from interface:URLContentRetrieverDownload artifact to given location. Implementation is expected to write file only if the content was fetched successfully- Specified by:
downloadUrlToin interfaceURLContentRetriever- Parameters:
srcUrl- source url to get artifact fromtarget- target file location- Returns:
- digest of downloaded context, or null if the content can not be retrieved by this transport
- Throws:
IOException- if operation failed, can also throwRecoverableIOExceptionif operation can be repeated
-
downloadUrlTo
@Nullable public String downloadUrlTo(@NotNull String srcUrl, @NotNull File target, @NotNull FileProgress fileDownloadProgress) throws IOException
Description copied from interface:ProgressTrackingURLContentRetrieverDownload artifact to a given location tracking downloading progress. Implementation is expected to write file only if the content was fetched successfully- Specified by:
downloadUrlToin interfaceProgressTrackingURLContentRetriever- Parameters:
srcUrl- source url to get artifact fromtarget- target file locationfileDownloadProgress- download progress holder- Returns:
- digest of downloaded context, or null if the content can not be retrieved by this transport
- Throws:
IOException- in case of exception
-
getId
public String getId()
- Specified by:
getIdin interfaceProgressTrackingURLContentRetriever- Returns:
- id of this retriever
-
getDigest
@Nullable public String getDigest(@NotNull String srcUrl) throws IOException
Description copied from interface:URLContentRetrieverRetrieve content's digest. The digest will be compared with locally stored value to see if content has changed and must be downloaded again.
Implementation is expected not to download whole content to get the digest.- Specified by:
getDigestin interfaceURLContentRetriever- Parameters:
srcUrl- source url of the artifact to retrieve digest for- Returns:
- the digest or null, if the digest can not be retrieved by this transport
- Throws:
IOException- if operation failed
-
interrupt
public void interrupt()
Description copied from interface:URLContentRetrieverInterrupt operation. Interrupts current transfer operation as early as possible. Will be called from external thread, so implementation should be thread-safe. Main thread is expected to throwResolvingInterruptedExceptionwhen interrupt is received- Specified by:
interruptin interfaceURLContentRetriever
-
releaseConnection
public void releaseConnection()
-
-