Class HttpTransporter
java.lang.Object
org.eclipse.aether.spi.connector.transport.AbstractTransporter
org.eclipse.aether.transport.http.HttpTransporter
- All Implemented Interfaces:
Closeable,AutoCloseable,Transporter
A transporter for HTTP/HTTPS.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate classprivate classprivate static class -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final URI(package private) static final Stringprivate final Map<String, ChecksumExtractor> private final org.apache.http.impl.client.CloseableHttpClientprivate static final Patternprivate final Map<?, ?> (package private) static final Stringprivate static final Stringprivate static final String(package private) static final Stringprivate static final org.slf4j.Logger(package private) static final Stringprivate final booleanprivate final booleanprivate final org.apache.http.HttpHostprivate final AuthenticationContextprivate final AuthenticationContextprivate final org.apache.http.HttpHostprivate final LocalState(package private) static final Stringprivate final boolean(package private) static final StringFields inherited from interface org.eclipse.aether.spi.connector.transport.Transporter
ERROR_NOT_FOUND, ERROR_OTHER -
Constructor Summary
ConstructorsConstructorDescriptionHttpTransporter(Map<String, ChecksumExtractor> checksumExtractors, RemoteRepository repository, RepositorySystemSession session) -
Method Summary
Modifier and TypeMethodDescriptionintClassifies the type of exception that has been thrown from a previous request to the transporter.private <T extends org.apache.http.client.methods.HttpUriRequest>
TcommonHeaders(T request) private <T extends org.apache.http.HttpEntityEnclosingRequest>
Tentity(T request, org.apache.http.HttpEntity entity) private voidexecute(org.apache.http.client.methods.HttpUriRequest request, HttpTransporter.EntityGetter getter) private InetAddressgetBindAddress(RepositorySystemSession session, RemoteRepository repository) Returns non-nullInetAddressif set in configuration,nullotherwise.(package private) LocalStategetState()private voidhandleStatus(org.apache.http.client.methods.CloseableHttpResponse response) protected voidImplementsAbstractTransporter.close(), gets only called if the transporter has not already been closed.protected voidImplementsAbstractTransporter.get(GetTask), gets only called if the transporter has not been closed.protected voidImplementsAbstractTransporter.peek(PeekTask), gets only called if the transporter has not been closed.protected voidImplementsAbstractTransporter.put(PutTask), gets only called if the transporter has not been closed.private booleanisPayloadPresent(org.apache.http.client.methods.HttpUriRequest request) private voidmkdirs(URI uri, SharingHttpContext context) private voidprepare(org.apache.http.client.methods.HttpUriRequest request, SharingHttpContext context) private URIresolve(TransportTask task) private <T extends org.apache.http.client.methods.HttpUriRequest>
Tprivate static org.apache.http.client.CredentialsProvidertoCredentialsProvider(String host, int port, AuthenticationContext ctx) private static org.apache.http.client.CredentialsProvidertoCredentialsProvider(org.apache.http.HttpHost server, AuthenticationContext serverAuthCtx, org.apache.http.HttpHost proxy, AuthenticationContext proxyAuthCtx) private static org.apache.http.HttpHost
-
Field Details
-
BIND_ADDRESS
- See Also:
-
SUPPORT_WEBDAV
- See Also:
-
PREEMPTIVE_PUT_AUTH
- See Also:
-
USE_SYSTEM_PROPERTIES
- See Also:
-
HTTP_RETRY_HANDLER_NAME
- See Also:
-
HTTP_RETRY_HANDLER_NAME_STANDARD
- See Also:
-
HTTP_RETRY_HANDLER_NAME_DEFAULT
- See Also:
-
HTTP_RETRY_HANDLER_REQUEST_SENT_ENABLED
- See Also:
-
CONTENT_RANGE_PATTERN
-
LOGGER
private static final org.slf4j.Logger LOGGER -
checksumExtractors
-
repoAuthContext
-
proxyAuthContext
-
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
-
state
-
preemptiveAuth
private final boolean preemptiveAuth -
preemptivePutAuth
private final boolean preemptivePutAuth -
supportWebDav
private final boolean supportWebDav
-
-
Constructor Details
-
HttpTransporter
HttpTransporter(Map<String, ChecksumExtractor> checksumExtractors, RemoteRepository repository, RepositorySystemSession session) throws NoTransporterException- Throws:
NoTransporterException
-
-
Method Details
-
getBindAddress
Returns non-nullInetAddressif set in configuration,nullotherwise. -
toHost
-
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
-
classify
Description copied from interface:TransporterClassifies 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 benull.- Returns:
- The classification of the error, either
Transporter.ERROR_NOT_FOUNDorTransporter.ERROR_OTHER.
-
implPeek
Description copied from class:AbstractTransporterImplementsAbstractTransporter.peek(PeekTask), gets only called if the transporter has not been closed.- Specified by:
implPeekin classAbstractTransporter- Parameters:
task- The existence check to perform, must not benull.- Throws:
Exception- If the existence of the specified resource could not be confirmed.
-
implGet
Description copied from class:AbstractTransporterImplementsAbstractTransporter.get(GetTask), gets only called if the transporter has not been closed.- Specified by:
implGetin classAbstractTransporter- Parameters:
task- The download to perform, must not benull.- Throws:
Exception- If the transfer failed.
-
implPut
Description copied from class:AbstractTransporterImplementsAbstractTransporter.put(PutTask), gets only called if the transporter has not been closed.- Specified by:
implPutin classAbstractTransporter- Parameters:
task- The upload to perform, must not benull.- 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
-
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
-
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:AbstractTransporterImplementsAbstractTransporter.close(), gets only called if the transporter has not already been closed.- Specified by:
implClosein classAbstractTransporter
-