@Contract(threading=SAFE) public abstract class CloseableHttpClient extends Object implements HttpClient, ModalCloseable
HttpClient
that also implements ModalCloseable
.Constructor and Description |
---|
CloseableHttpClient() |
Modifier and Type | Method and Description |
---|---|
protected abstract CloseableHttpResponse |
doExecute(HttpHost target,
ClassicHttpRequest request,
HttpContext context) |
CloseableHttpResponse |
execute(ClassicHttpRequest request)
Executes HTTP request using the default context.
|
<T> T |
execute(ClassicHttpRequest request,
HttpClientResponseHandler<? extends T> responseHandler)
Executes a request using the default context and processes the
response using the given response handler.
|
CloseableHttpResponse |
execute(ClassicHttpRequest request,
HttpContext context)
Executes HTTP request using the given context.
|
<T> T |
execute(ClassicHttpRequest request,
HttpContext context,
HttpClientResponseHandler<? extends T> responseHandler)
Executes a request using the default context and processes the
response using the given response handler.
|
CloseableHttpResponse |
execute(HttpHost target,
ClassicHttpRequest request)
Executes HTTP request using the default context.
|
<T> T |
execute(HttpHost target,
ClassicHttpRequest request,
HttpClientResponseHandler<? extends T> responseHandler)
Executes a request using the default context and processes the
response using the given response handler.
|
CloseableHttpResponse |
execute(HttpHost target,
ClassicHttpRequest request,
HttpContext context)
Executes HTTP request using the given context.
|
<T> T |
execute(HttpHost target,
ClassicHttpRequest request,
HttpContext context,
HttpClientResponseHandler<? extends T> responseHandler)
Executes a request using the default context and processes the
response using the given response handler.
|
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
close
protected abstract CloseableHttpResponse doExecute(HttpHost target, ClassicHttpRequest request, HttpContext context) throws IOException
IOException
public CloseableHttpResponse execute(ClassicHttpRequest request) throws IOException
HttpClient
execute
in interface HttpClient
request
- the request to executeIOException
- in case of a problem or the connection was abortedpublic <T> T execute(ClassicHttpRequest request, 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 CloseableHttpResponse execute(ClassicHttpRequest request, 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 <T> T execute(ClassicHttpRequest request, HttpContext context, 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 CloseableHttpResponse execute(HttpHost target, 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(HttpHost target, ClassicHttpRequest request, 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 CloseableHttpResponse execute(HttpHost target, ClassicHttpRequest request, 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 <T> T execute(HttpHost target, ClassicHttpRequest request, HttpContext context, 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 error