@Contract(threading=SAFE) public abstract class CloseableHttpClient extends Object implements HttpClient, org.apache.hc.core5.io.ModalCloseable
HttpClient
that also implements ModalCloseable
.Constructor and Description |
---|
CloseableHttpClient() |
Modifier and Type | Method and Description |
---|---|
protected abstract CloseableHttpResponse |
doExecute(org.apache.hc.core5.http.HttpHost target,
org.apache.hc.core5.http.ClassicHttpRequest request,
org.apache.hc.core5.http.protocol.HttpContext context) |
CloseableHttpResponse |
execute(org.apache.hc.core5.http.ClassicHttpRequest request)
Executes HTTP request using the default context.
|
<T> T |
execute(org.apache.hc.core5.http.ClassicHttpRequest request,
org.apache.hc.core5.http.io.HttpClientResponseHandler<? extends T> responseHandler)
Executes a request using the default context and processes the
response using the given response handler.
|
CloseableHttpResponse |
execute(org.apache.hc.core5.http.ClassicHttpRequest request,
org.apache.hc.core5.http.protocol.HttpContext context)
Executes HTTP request using the given 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)
Executes a request using the default context and processes the
response using the given response handler.
|
CloseableHttpResponse |
execute(org.apache.hc.core5.http.HttpHost target,
org.apache.hc.core5.http.ClassicHttpRequest request)
Executes HTTP request using the default context.
|
<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)
Executes a request using the default context and processes the
response using the given response handler.
|
CloseableHttpResponse |
execute(org.apache.hc.core5.http.HttpHost target,
org.apache.hc.core5.http.ClassicHttpRequest request,
org.apache.hc.core5.http.protocol.HttpContext context)
Executes HTTP request using the given 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)
Executes a request using the default context and processes the
response using the given response handler.
|
protected abstract CloseableHttpResponse doExecute(org.apache.hc.core5.http.HttpHost target, org.apache.hc.core5.http.ClassicHttpRequest request, org.apache.hc.core5.http.protocol.HttpContext context) throws IOException
IOException
public CloseableHttpResponse execute(org.apache.hc.core5.http.HttpHost target, org.apache.hc.core5.http.ClassicHttpRequest request, org.apache.hc.core5.http.protocol.HttpContext context) throws IOException
HttpClient
execute
in interface HttpClient
target
- the target host for the request.
Implementations may accept null
if they can still determine a route, for example
to a default target or by inspecting the request.request
- the request to executecontext
- the context to use for the execution, or
null
to use the default contextIOException
- in case of a problem or the connection was abortedpublic CloseableHttpResponse execute(org.apache.hc.core5.http.ClassicHttpRequest request, org.apache.hc.core5.http.protocol.HttpContext context) throws IOException
HttpClient
execute
in interface HttpClient
request
- the request to executecontext
- the context to use for the execution, or
null
to use the default contextIOException
- in case of a problem or the connection was abortedpublic CloseableHttpResponse execute(org.apache.hc.core5.http.ClassicHttpRequest request) throws IOException
HttpClient
execute
in interface HttpClient
request
- the request to executeIOException
- in case of a problem or the connection was abortedpublic CloseableHttpResponse execute(org.apache.hc.core5.http.HttpHost target, org.apache.hc.core5.http.ClassicHttpRequest request) throws IOException
HttpClient
execute
in interface HttpClient
target
- the target host for the request.
Implementations may accept null
if they can still determine a route, for example
to a default target or by inspecting the request.request
- the request to executeIOException
- in case of a problem or the connection was abortedpublic <T> T execute(org.apache.hc.core5.http.ClassicHttpRequest request, org.apache.hc.core5.http.io.HttpClientResponseHandler<? extends T> responseHandler) throws IOException
HttpClientResponseHandler
s from having to manage
resource deallocation internally.execute
in interface HttpClient
request
- the request to executeresponseHandler
- the response handlerIOException
- in case of a problem or the connection was abortedClientProtocolException
- in case of an http protocol errorpublic <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) throws IOException
HttpClientResponseHandler
s from having to manage
resource deallocation internally.execute
in interface HttpClient
request
- the request to executeresponseHandler
- the response handlercontext
- the context to use for the execution, or
null
to use the default contextIOException
- in case of a problem or the connection was abortedClientProtocolException
- in case of an http protocol errorpublic <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) throws IOException
HttpClientResponseHandler
s from having to manage
resource deallocation internally.execute
in interface HttpClient
target
- the target host for the request.
Implementations may accept null
if they can still determine a route, for example
to a default target or by inspecting the request.request
- the request to executeresponseHandler
- the response handlerIOException
- in case of a problem or the connection was abortedClientProtocolException
- in case of an http protocol errorpublic <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) throws IOException
HttpClientResponseHandler
s from having to manage
resource deallocation internally.execute
in interface HttpClient
target
- the target host for the request.
Implementations may accept null
if they can still determine a route, for example
to a default target or by inspecting the request.request
- the request to executecontext
- the context to use for the execution, or
null
to use the default contextresponseHandler
- the response handlerIOException
- in case of a problem or the connection was abortedClientProtocolException
- in case of an http protocol errorCopyright © 1999–2022 The Apache Software Foundation. All rights reserved.