Class HttpTransport

    • 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 interface URLContentRetriever
        Parameters:
        srcUrl - source url to get artifact from
        target - 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 throw RecoverableIOException 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 interface ProgressTrackingURLContentRetriever
        Parameters:
        srcUrl - source url to get artifact from
        target - target file location
        fileDownloadProgress - 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
      • 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 interface URLContentRetriever
        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 throw ResolvingInterruptedException when interrupt is received
        Specified by:
        interrupt in interface URLContentRetriever
      • releaseConnection

        public void releaseConnection()