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`, `RequestTimeLimitingHttpClient`

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
Modifier and Type
Field
Description
`private static final org.slf4j.Logger`
`LOG`
Logger.

## Constructor Summary

Constructors
Constructor
Description
`AbstractHttpClient()`

## Method Summary

Modifier and Type
Method
Description
`private static org.apache.hc.core5.http.HttpHost`
`determineTarget(org.apache.hc.core5.http.ClassicHttpRequest request)`
Determine the `HttpHost` instance based on the specified request.
`protected abstract org.apache.hc.core5.http.ClassicHttpResponse`
`doExecute(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.ClassicHttpResponse`
`execute(org.apache.hc.core5.http.ClassicHttpRequest request)`
`<T> T`
`execute(org.apache.hc.core5.http.ClassicHttpRequest request, org.apache.hc.core5.http.io.HttpClientResponseHandler<? extends T> responseHandler)`
`org.apache.hc.core5.http.ClassicHttpResponse`
`execute(org.apache.hc.core5.http.ClassicHttpRequest request, org.apache.hc.core5.http.protocol.HttpContext context)`
`<T> T`
`execute(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.ClassicHttpResponse`
`execute(org.apache.hc.core5.http.HttpHost target, org.apache.hc.core5.http.ClassicHttpRequest request)`
`<T> T`
`execute(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.ClassicHttpResponse`
`execute(org.apache.hc.core5.http.HttpHost target, org.apache.hc.core5.http.ClassicHttpRequest request, org.apache.hc.core5.http.protocol.HttpContext context)`
`<T> T`
`execute(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, wait`

### Methods inherited from interface java.io.Closeable

`close`

### Methods inherited from interface org.apache.hc.client5.http.classic.HttpClient

`executeOpen`

### Methods inherited from interface org.apache.hc.core5.io.ModalCloseable

`close`

## Field Details

### LOG

private static final org.slf4j.Logger LOG
Logger.

## 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 be `null`
  `request` - the request to execute
  `context` - the context to use for the execution, or `null` to 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 the `HttpHost` instance based on the specified request.

Parameters:
  `request` - the request being executed
Returns:
  the `HttpHost` instance 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:
  `execute` in interface `org.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:
  `execute` in interface `org.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:
  `execute` in interface `org.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:
  `execute` in interface `org.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:
  `execute` in interface `org.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:
  `execute` in interface `org.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:
  `execute` in interface `org.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:
  `execute` in interface `org.apache.hc.client5.http.classic.HttpClient`
Throws:
  `IOException`