Class HttpTransporter

  • All Implemented Interfaces:
    java.io.Closeable, java.lang.AutoCloseable, Transporter

    final class HttpTransporter
    extends AbstractTransporter
    A transporter for HTTP/HTTPS.
    • Field Detail

      • CONTENT_RANGE_PATTERN

        private static final java.util.regex.Pattern CONTENT_RANGE_PATTERN
      • LOGGER

        private static final org.slf4j.Logger LOGGER
      • baseUri

        private final java.net.URI baseUri
      • server

        private final org.apache.http.HttpHost server
      • proxy

        private final org.apache.http.HttpHost proxy
      • client

        private final org.apache.http.impl.client.CloseableHttpClient client
      • headers

        private final java.util.Map<?,​?> headers
    • Method Detail

      • toHost

        private static org.apache.http.HttpHost toHost​(Proxy proxy)
      • toCredentialsProvider

        private static org.apache.http.client.CredentialsProvider toCredentialsProvider​(org.apache.http.HttpHost server,
                                                                                        AuthenticationContext serverAuthCtx,
                                                                                        org.apache.http.HttpHost proxy,
                                                                                        AuthenticationContext proxyAuthCtx)
      • toCredentialsProvider

        private static org.apache.http.client.CredentialsProvider toCredentialsProvider​(java.lang.String host,
                                                                                        int port,
                                                                                        AuthenticationContext ctx)
      • classify

        public int classify​(java.lang.Throwable error)
        Description copied from interface: Transporter
        Classifies the type of exception that has been thrown from a previous request to the transporter. The exception types employed by a transporter are generally unknown to its caller. Where a caller needs to distinguish between certain error cases, it employs this method to detect which error case corresponds to the exception.
        Parameters:
        error - The exception to classify, must not be null.
        Returns:
        The classification of the error, either Transporter.ERROR_NOT_FOUND or Transporter.ERROR_OTHER.
      • implPeek

        protected void implPeek​(PeekTask task)
                         throws java.lang.Exception
        Description copied from class: AbstractTransporter
        Implements AbstractTransporter.peek(PeekTask), gets only called if the transporter has not been closed.
        Specified by:
        implPeek in class AbstractTransporter
        Parameters:
        task - The existence check to perform, must not be null.
        Throws:
        java.lang.Exception - If the existence of the specified resource could not be confirmed.
      • execute

        private void execute​(org.apache.http.client.methods.HttpUriRequest request,
                             HttpTransporter.EntityGetter getter)
                      throws java.lang.Exception
        Throws:
        java.lang.Exception
      • prepare

        private void prepare​(org.apache.http.client.methods.HttpUriRequest request,
                             SharingHttpContext context)
      • isWebDav

        private boolean isWebDav​(org.apache.http.HttpResponse response)
      • entity

        private <T extends org.apache.http.HttpEntityEnclosingRequest> T entity​(T request,
                                                                                org.apache.http.HttpEntity entity)
      • isPayloadPresent

        private boolean isPayloadPresent​(org.apache.http.client.methods.HttpUriRequest request)
      • commonHeaders

        private <T extends org.apache.http.client.methods.HttpUriRequest> T commonHeaders​(T request)
      • resume

        private <T extends org.apache.http.client.methods.HttpUriRequest> T resume​(T request,
                                                                                   GetTask task)
      • handleStatus

        private void handleStatus​(org.apache.http.HttpResponse response)
                           throws org.apache.http.client.HttpResponseException
        Throws:
        org.apache.http.client.HttpResponseException