Package net.shibboleth.shared.httpclient
Class AbstractHttpClient
java.lang.Object
net.shibboleth.shared.httpclient.AbstractHttpClient
- All Implemented Interfaces:
Closeable,AutoCloseable,org.apache.hc.client5.http.classic.HttpClient,org.apache.hc.core5.io.ModalCloseable
- Direct Known Subclasses:
ContextHandlingHttpClient,FileCachingHttpClientBuilder.StorageManagingHttpClient
public abstract class AbstractHttpClient
extends Object
implements org.apache.hc.client5.http.classic.HttpClient, org.apache.hc.core5.io.ModalCloseable
Basic abstract implementation of
HttpClient.
Based on CloseableHttpClient.-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate static org.apache.hc.core5.http.HttpHostdetermineTarget(org.apache.hc.core5.http.ClassicHttpRequest request) Determine theHttpHostinstance based on the specified request.protected abstract org.apache.hc.core5.http.ClassicHttpResponsedoExecute(org.apache.hc.core5.http.HttpHost target, org.apache.hc.core5.http.ClassicHttpRequest request, org.apache.hc.core5.http.protocol.HttpContext context) Execute the HTTP request.org.apache.hc.core5.http.ClassicHttpResponseexecute(org.apache.hc.core5.http.ClassicHttpRequest request) <T> Texecute(org.apache.hc.core5.http.ClassicHttpRequest request, org.apache.hc.core5.http.io.HttpClientResponseHandler<? extends T> responseHandler) org.apache.hc.core5.http.ClassicHttpResponseexecute(org.apache.hc.core5.http.ClassicHttpRequest request, org.apache.hc.core5.http.protocol.HttpContext context) <T> Texecute(org.apache.hc.core5.http.ClassicHttpRequest request, org.apache.hc.core5.http.protocol.HttpContext context, org.apache.hc.core5.http.io.HttpClientResponseHandler<? extends T> responseHandler) org.apache.hc.core5.http.ClassicHttpResponseexecute(org.apache.hc.core5.http.HttpHost target, org.apache.hc.core5.http.ClassicHttpRequest request) <T> Texecute(org.apache.hc.core5.http.HttpHost target, org.apache.hc.core5.http.ClassicHttpRequest request, org.apache.hc.core5.http.io.HttpClientResponseHandler<? extends T> responseHandler) org.apache.hc.core5.http.ClassicHttpResponseexecute(org.apache.hc.core5.http.HttpHost target, org.apache.hc.core5.http.ClassicHttpRequest request, org.apache.hc.core5.http.protocol.HttpContext context) <T> Texecute(org.apache.hc.core5.http.HttpHost target, org.apache.hc.core5.http.ClassicHttpRequest request, org.apache.hc.core5.http.protocol.HttpContext context, org.apache.hc.core5.http.io.HttpClientResponseHandler<? extends T> responseHandler) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.hc.client5.http.classic.HttpClient
executeOpenMethods inherited from interface org.apache.hc.core5.io.ModalCloseable
close
-
Field Details
-
LOG
private static final org.slf4j.Logger LOGLogger.
-
-
Constructor Details
-
AbstractHttpClient
public AbstractHttpClient()
-
-
Method Details
-
doExecute
protected abstract org.apache.hc.core5.http.ClassicHttpResponse doExecute(@Nullable org.apache.hc.core5.http.HttpHost target, @Nonnull org.apache.hc.core5.http.ClassicHttpRequest request, @Nullable org.apache.hc.core5.http.protocol.HttpContext context) throws IOException Execute the HTTP request.- Parameters:
target- the target host for the request, may benullrequest- the request to executecontext- the context to use for the execution, ornullto use the default context- Returns:
- the response to the request
- Throws:
IOException- in case of a problem or the connection was aborted
-
determineTarget
private static org.apache.hc.core5.http.HttpHost determineTarget(@Nullable org.apache.hc.core5.http.ClassicHttpRequest request) throws org.apache.hc.client5.http.ClientProtocolException Determine theHttpHostinstance based on the specified request.- Parameters:
request- the request being executed- Returns:
- the
HttpHostinstance reflecting the specified request - Throws:
org.apache.hc.client5.http.ClientProtocolException- if target host can not be determined
-
execute
public org.apache.hc.core5.http.ClassicHttpResponse execute(@Nullable org.apache.hc.core5.http.HttpHost target, @Nullable org.apache.hc.core5.http.ClassicHttpRequest request, @Nullable org.apache.hc.core5.http.protocol.HttpContext context) throws IOException - Specified by:
executein interfaceorg.apache.hc.client5.http.classic.HttpClient- Throws:
IOException
-
execute
public org.apache.hc.core5.http.ClassicHttpResponse execute(@Nullable org.apache.hc.core5.http.ClassicHttpRequest request, @Nullable org.apache.hc.core5.http.protocol.HttpContext context) throws IOException - Specified by:
executein interfaceorg.apache.hc.client5.http.classic.HttpClient- Throws:
IOException
-
execute
public org.apache.hc.core5.http.ClassicHttpResponse execute(@Nullable org.apache.hc.core5.http.ClassicHttpRequest request) throws IOException - Specified by:
executein interfaceorg.apache.hc.client5.http.classic.HttpClient- Throws:
IOException
-
execute
public org.apache.hc.core5.http.ClassicHttpResponse execute(@Nullable org.apache.hc.core5.http.HttpHost target, @Nullable org.apache.hc.core5.http.ClassicHttpRequest request) throws IOException - Specified by:
executein interfaceorg.apache.hc.client5.http.classic.HttpClient- Throws:
IOException
-
execute
public <T> T execute(@Nullable org.apache.hc.core5.http.ClassicHttpRequest request, @Nullable org.apache.hc.core5.http.io.HttpClientResponseHandler<? extends T> responseHandler) throws IOException - Specified by:
executein interfaceorg.apache.hc.client5.http.classic.HttpClient- Throws:
IOException
-
execute
public <T> T execute(@Nullable org.apache.hc.core5.http.ClassicHttpRequest request, @Nullable org.apache.hc.core5.http.protocol.HttpContext context, @Nullable org.apache.hc.core5.http.io.HttpClientResponseHandler<? extends T> responseHandler) throws IOException - Specified by:
executein interfaceorg.apache.hc.client5.http.classic.HttpClient- Throws:
IOException
-
execute
public <T> T execute(@Nullable org.apache.hc.core5.http.HttpHost target, @Nullable org.apache.hc.core5.http.ClassicHttpRequest request, @Nullable org.apache.hc.core5.http.io.HttpClientResponseHandler<? extends T> responseHandler) throws IOException - Specified by:
executein interfaceorg.apache.hc.client5.http.classic.HttpClient- Throws:
IOException
-
execute
public <T> T execute(@Nullable org.apache.hc.core5.http.HttpHost target, @Nullable org.apache.hc.core5.http.ClassicHttpRequest request, @Nullable org.apache.hc.core5.http.protocol.HttpContext context, @Nullable org.apache.hc.core5.http.io.HttpClientResponseHandler<? extends T> responseHandler) throws IOException - Specified by:
executein interfaceorg.apache.hc.client5.http.classic.HttpClient- Throws:
IOException
-