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 String
CONNECTION_REFUSED
static String
ILLEGAL_STATUS
static String
ILLEGAL_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 String
downloadUrlTo(String srcUrl, File target)
Download artifact to given location.String
downloadUrlTo(String srcUrl, File target, FileProgress fileDownloadProgress)
Download artifact to a given location tracking downloading progress.String
getDigest(String srcUrl)
Retrieve content's digest.String
getId()
void
interrupt()
Interrupt operation.void
releaseConnection()
String
toString()
-
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:URLContentRetriever
Download artifact to given location. Implementation is expected to write file only if the content was fetched successfully- Specified by:
downloadUrlTo
in 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 throwRecoverableIOException
if operation can be repeated
-
downloadUrlTo
@Nullable public String downloadUrlTo(@NotNull String srcUrl, @NotNull File target, @NotNull FileProgress fileDownloadProgress) throws IOException
Description copied from interface:ProgressTrackingURLContentRetriever
Download artifact to a given location tracking downloading progress. Implementation is expected to write file only if the content was fetched successfully- Specified by:
downloadUrlTo
in 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:
getId
in interfaceProgressTrackingURLContentRetriever
- Returns:
- id of this retriever
-
getDigest
@Nullable public String getDigest(@NotNull String srcUrl) throws IOException
Description copied from interface:URLContentRetriever
Retrieve 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:
getDigest
in 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:URLContentRetriever
Interrupt 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 throwResolvingInterruptedException
when interrupt is received- Specified by:
interrupt
in interfaceURLContentRetriever
-
releaseConnection
public void releaseConnection()
-
-