Class HttpTransporter

java.lang.Object
org.eclipse.aether.spi.connector.transport.AbstractTransporter
org.eclipse.aether.transport.http.HttpTransporter
All Implemented Interfaces:
Closeable, AutoCloseable, Transporter

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

    • BIND_ADDRESS

      static final String BIND_ADDRESS
      See Also:
    • SUPPORT_WEBDAV

      static final String SUPPORT_WEBDAV
      See Also:
    • PREEMPTIVE_PUT_AUTH

      static final String PREEMPTIVE_PUT_AUTH
      See Also:
    • USE_SYSTEM_PROPERTIES

      static final String USE_SYSTEM_PROPERTIES
      See Also:
    • HTTP_RETRY_HANDLER_NAME

      static final String HTTP_RETRY_HANDLER_NAME
      See Also:
    • HTTP_RETRY_HANDLER_NAME_STANDARD

      private static final String HTTP_RETRY_HANDLER_NAME_STANDARD
      See Also:
    • HTTP_RETRY_HANDLER_NAME_DEFAULT

      private static final String HTTP_RETRY_HANDLER_NAME_DEFAULT
      See Also:
    • HTTP_RETRY_HANDLER_REQUEST_SENT_ENABLED

      static final String HTTP_RETRY_HANDLER_REQUEST_SENT_ENABLED
      See Also:
    • CONTENT_RANGE_PATTERN

      private static final Pattern CONTENT_RANGE_PATTERN
    • LOGGER

      private static final org.slf4j.Logger LOGGER
    • checksumExtractors

      private final Map<String,ChecksumExtractor> checksumExtractors
    • repoAuthContext

      private final AuthenticationContext repoAuthContext
    • proxyAuthContext

      private final AuthenticationContext proxyAuthContext
    • baseUri

      private final 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 Map<?,?> headers
    • state

      private final LocalState state
    • preemptiveAuth

      private final boolean preemptiveAuth
    • preemptivePutAuth

      private final boolean preemptivePutAuth
    • supportWebDav

      private final boolean supportWebDav
  • Constructor Details

  • Method Details

    • getBindAddress

      private InetAddress getBindAddress(RepositorySystemSession session, RemoteRepository repository)
      Returns non-null InetAddress if set in configuration, null otherwise.
    • 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(String host, int port, AuthenticationContext ctx)
    • getState

      LocalState getState()
    • resolve

      private URI resolve(TransportTask task)
    • classify

      public int classify(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 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:
      Exception - If the existence of the specified resource could not be confirmed.
    • implGet

      protected void implGet(GetTask task) throws Exception
      Description copied from class: AbstractTransporter
      Implements AbstractTransporter.get(GetTask), gets only called if the transporter has not been closed.
      Specified by:
      implGet in class AbstractTransporter
      Parameters:
      task - The download to perform, must not be null.
      Throws:
      Exception - If the transfer failed.
    • implPut

      protected void implPut(PutTask task) throws Exception
      Description copied from class: AbstractTransporter
      Implements AbstractTransporter.put(PutTask), gets only called if the transporter has not been closed.
      Specified by:
      implPut in class AbstractTransporter
      Parameters:
      task - The upload to perform, must not be null.
      Throws:
      Exception - If the transfer failed.
    • execute

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

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

      private void mkdirs(URI uri, SharingHttpContext context)
    • 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.client.methods.CloseableHttpResponse response) throws org.apache.http.client.HttpResponseException
      Throws:
      org.apache.http.client.HttpResponseException
    • implClose

      protected void implClose()
      Description copied from class: AbstractTransporter
      Implements AbstractTransporter.close(), gets only called if the transporter has not already been closed.
      Specified by:
      implClose in class AbstractTransporter