final class HttpTransporter extends AbstractTransporter
Modifier and Type | Class and Description |
---|---|
private class |
HttpTransporter.EntityGetter |
private class |
HttpTransporter.PutTaskEntity |
Modifier and Type | Field and Description |
---|---|
private java.net.URI |
baseUri |
private org.apache.http.impl.client.CloseableHttpClient |
client |
private static java.util.regex.Pattern |
CONTENT_RANGE_PATTERN |
private java.util.Map<?,?> |
headers |
private static org.slf4j.Logger |
LOGGER |
private org.apache.http.HttpHost |
proxy |
private AuthenticationContext |
proxyAuthContext |
private AuthenticationContext |
repoAuthContext |
private org.apache.http.HttpHost |
server |
private LocalState |
state |
ERROR_NOT_FOUND, ERROR_OTHER
Constructor and Description |
---|
HttpTransporter(RemoteRepository repository,
RepositorySystemSession session) |
Modifier and Type | Method and Description |
---|---|
int |
classify(java.lang.Throwable error)
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> |
commonHeaders(T request) |
private <T extends org.apache.http.HttpEntityEnclosingRequest> |
entity(T request,
org.apache.http.HttpEntity entity) |
private void |
execute(org.apache.http.client.methods.HttpUriRequest request,
HttpTransporter.EntityGetter getter) |
(package private) LocalState |
getState() |
private void |
handleStatus(org.apache.http.HttpResponse response) |
protected void |
implClose()
Implements
AbstractTransporter.close() , gets only called if the transporter has not already been closed. |
protected void |
implGet(GetTask task)
Implements
AbstractTransporter.get(GetTask) , gets only called if the transporter has not been closed. |
protected void |
implPeek(PeekTask task)
Implements
AbstractTransporter.peek(PeekTask) , gets only called if the transporter has not been closed. |
protected void |
implPut(PutTask task)
Implements
AbstractTransporter.put(PutTask) , gets only called if the transporter has not been closed. |
private boolean |
isPayloadPresent(org.apache.http.client.methods.HttpUriRequest request) |
private boolean |
isWebDav(org.apache.http.HttpResponse response) |
private void |
mkdirs(java.net.URI uri,
SharingHttpContext context) |
private void |
prepare(org.apache.http.client.methods.HttpUriRequest request,
SharingHttpContext context) |
private java.net.URI |
resolve(TransportTask task) |
private <T extends org.apache.http.client.methods.HttpUriRequest> |
resume(T request,
GetTask task) |
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.client.CredentialsProvider |
toCredentialsProvider(java.lang.String host,
int port,
AuthenticationContext ctx) |
private static org.apache.http.HttpHost |
toHost(Proxy proxy) |
private static final java.util.regex.Pattern CONTENT_RANGE_PATTERN
private static final org.slf4j.Logger LOGGER
private final AuthenticationContext repoAuthContext
private final AuthenticationContext proxyAuthContext
private final java.net.URI baseUri
private final org.apache.http.HttpHost server
private final org.apache.http.HttpHost proxy
private final org.apache.http.impl.client.CloseableHttpClient client
private final java.util.Map<?,?> headers
private final LocalState state
HttpTransporter(RemoteRepository repository, RepositorySystemSession session) throws NoTransporterException
NoTransporterException
private static org.apache.http.HttpHost toHost(Proxy proxy)
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.client.CredentialsProvider toCredentialsProvider(java.lang.String host, int port, AuthenticationContext ctx)
LocalState getState()
private java.net.URI resolve(TransportTask task)
public int classify(java.lang.Throwable error)
Transporter
error
- The exception to classify, must not be null
.Transporter.ERROR_NOT_FOUND
or Transporter.ERROR_OTHER
.protected void implPeek(PeekTask task) throws java.lang.Exception
AbstractTransporter
AbstractTransporter.peek(PeekTask)
, gets only called if the transporter has not been closed.implPeek
in class AbstractTransporter
task
- The existence check to perform, must not be null
.java.lang.Exception
- If the existence of the specified resource could not be confirmed.protected void implGet(GetTask task) throws java.lang.Exception
AbstractTransporter
AbstractTransporter.get(GetTask)
, gets only called if the transporter has not been closed.implGet
in class AbstractTransporter
task
- The download to perform, must not be null
.java.lang.Exception
- If the transfer failed.protected void implPut(PutTask task) throws java.lang.Exception
AbstractTransporter
AbstractTransporter.put(PutTask)
, gets only called if the transporter has not been closed.implPut
in class AbstractTransporter
task
- The upload to perform, must not be null
.java.lang.Exception
- If the transfer failed.private void execute(org.apache.http.client.methods.HttpUriRequest request, HttpTransporter.EntityGetter getter) throws java.lang.Exception
java.lang.Exception
private void prepare(org.apache.http.client.methods.HttpUriRequest request, SharingHttpContext context)
private boolean isWebDav(org.apache.http.HttpResponse response)
private void mkdirs(java.net.URI uri, SharingHttpContext context)
private <T extends org.apache.http.HttpEntityEnclosingRequest> T entity(T request, org.apache.http.HttpEntity entity)
private boolean isPayloadPresent(org.apache.http.client.methods.HttpUriRequest request)
private <T extends org.apache.http.client.methods.HttpUriRequest> T commonHeaders(T request)
private <T extends org.apache.http.client.methods.HttpUriRequest> T resume(T request, GetTask task)
private void handleStatus(org.apache.http.HttpResponse response) throws org.apache.http.client.HttpResponseException
org.apache.http.client.HttpResponseException
protected void implClose()
AbstractTransporter
AbstractTransporter.close()
, gets only called if the transporter has not already been closed.implClose
in class AbstractTransporter