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 class
private class
private static class
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final URI
(package private) static final String
private final Map
<String, ChecksumExtractor> private final org.apache.http.impl.client.CloseableHttpClient
private static final Pattern
private final Map
<?, ?> (package private) static final String
private static final String
private static final String
(package private) static final String
private static final org.slf4j.Logger
(package private) static final String
private final boolean
private final boolean
private final org.apache.http.HttpHost
private final AuthenticationContext
private final AuthenticationContext
private final org.apache.http.HttpHost
private final LocalState
(package private) static final String
private final boolean
(package private) static final String
Fields 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 TypeMethodDescriptionint
Classifies 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 void
execute
(org.apache.http.client.methods.HttpUriRequest request, HttpTransporter.EntityGetter getter) private InetAddress
getBindAddress
(RepositorySystemSession session, RemoteRepository repository) Returns non-nullInetAddress
if set in configuration,null
otherwise.(package private) LocalState
getState()
private void
handleStatus
(org.apache.http.client.methods.CloseableHttpResponse response) protected void
ImplementsAbstractTransporter.close()
, gets only called if the transporter has not already been closed.protected void
ImplementsAbstractTransporter.get(GetTask)
, gets only called if the transporter has not been closed.protected void
ImplementsAbstractTransporter.peek(PeekTask)
, gets only called if the transporter has not been closed.protected void
ImplementsAbstractTransporter.put(PutTask)
, gets only called if the transporter has not been closed.private boolean
isPayloadPresent
(org.apache.http.client.methods.HttpUriRequest request) private void
mkdirs
(URI uri, SharingHttpContext context) private void
prepare
(org.apache.http.client.methods.HttpUriRequest request, SharingHttpContext context) private URI
resolve
(TransportTask task) private <T extends org.apache.http.client.methods.HttpUriRequest>
Tprivate static org.apache.http.client.CredentialsProvider
toCredentialsProvider
(String host, int port, AuthenticationContext ctx) private static org.apache.http.client.CredentialsProvider
toCredentialsProvider
(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-nullInetAddress
if set in configuration,null
otherwise. -
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: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 benull
.- Returns:
- The classification of the error, either
Transporter.ERROR_NOT_FOUND
orTransporter.ERROR_OTHER
.
-
implPeek
Description copied from class:AbstractTransporter
ImplementsAbstractTransporter.peek(PeekTask)
, gets only called if the transporter has not been closed.- Specified by:
implPeek
in 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:AbstractTransporter
ImplementsAbstractTransporter.get(GetTask)
, gets only called if the transporter has not been closed.- Specified by:
implGet
in classAbstractTransporter
- Parameters:
task
- The download to perform, must not benull
.- Throws:
Exception
- If the transfer failed.
-
implPut
Description copied from class:AbstractTransporter
ImplementsAbstractTransporter.put(PutTask)
, gets only called if the transporter has not been closed.- Specified by:
implPut
in 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:AbstractTransporter
ImplementsAbstractTransporter.close()
, gets only called if the transporter has not already been closed.- Specified by:
implClose
in classAbstractTransporter
-