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 class -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final URIprivate final org.apache.http.impl.client.CloseableHttpClientprivate static final Patternprivate final Map<?,?> private static final org.slf4j.Loggerprivate final org.apache.http.HttpHostprivate final AuthenticationContextprivate final AuthenticationContextprivate final org.apache.http.HttpHostprivate final LocalStateFields inherited from interface org.eclipse.aether.spi.connector.transport.Transporter
ERROR_NOT_FOUND, ERROR_OTHER -
Constructor Summary
ConstructorsConstructorDescriptionHttpTransporter(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) (package private) LocalStategetState()private voidhandleStatus(org.apache.http.HttpResponse 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 booleanisWebDav(org.apache.http.HttpResponse response) 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
-
CONTENT_RANGE_PATTERN
-
LOGGER
private static final org.slf4j.Logger LOGGER -
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
-
-
Constructor Details
-
HttpTransporter
HttpTransporter(RemoteRepository repository, RepositorySystemSession session) throws NoTransporterException - Throws:
NoTransporterException
-
-
Method Details
-
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) -
isWebDav
private boolean isWebDav(org.apache.http.HttpResponse response) -
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.HttpResponse 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
-