@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)
Deprecated.
It is strongly recommended to use execute methods with
HttpClientResponseHandler
such as execute(ClassicHttpRequest, HttpClientResponseHandler) in order
to ensure automatic resource deallocation by the client.
For special cases one can still use HttpClient.executeOpen(HttpHost, ClassicHttpRequest, HttpContext)
to keep the response object open after the request execution. |
<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)
Deprecated.
It is strongly recommended to use execute methods with
HttpClientResponseHandler
such as execute(ClassicHttpRequest, HttpContext, HttpClientResponseHandler) in order
to ensure automatic resource deallocation by the client.
For special cases one can still use HttpClient.executeOpen(HttpHost, ClassicHttpRequest, HttpContext)
to keep the response object open after the request execution. |
<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)
Deprecated.
It is strongly recommended to use execute methods with
HttpClientResponseHandler
such as execute(HttpHost, ClassicHttpRequest, HttpClientResponseHandler) in order
to ensure automatic resource deallocation by the client.
For special cases one can still use HttpClient.executeOpen(HttpHost, ClassicHttpRequest, HttpContext)
to keep the response object open after the request execution. |
<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)
Deprecated.
It is strongly recommended to use execute methods with
HttpClientResponseHandler
such as execute(HttpHost, ClassicHttpRequest, HttpContext, HttpClientResponseHandler) in order
to ensure automatic resource deallocation by the client.
For special cases one can still use HttpClient.executeOpen(HttpHost, ClassicHttpRequest, HttpContext)
to keep the response object open after the request execution. |
<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.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
executeOpen
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
@Deprecated 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
HttpClientResponseHandler
such as execute(HttpHost, ClassicHttpRequest, HttpContext, HttpClientResponseHandler)
in order
to ensure automatic resource deallocation by the client.
For special cases one can still use HttpClient.executeOpen(HttpHost, ClassicHttpRequest, HttpContext)
to keep the response object open after the request execution.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 abortedexecute(HttpHost, ClassicHttpRequest, HttpContext, HttpClientResponseHandler)
,
HttpClient.executeOpen(HttpHost, ClassicHttpRequest, HttpContext)
@Deprecated public CloseableHttpResponse execute(org.apache.hc.core5.http.ClassicHttpRequest request, org.apache.hc.core5.http.protocol.HttpContext context) throws IOException
HttpClientResponseHandler
such as execute(ClassicHttpRequest, HttpContext, HttpClientResponseHandler)
in order
to ensure automatic resource deallocation by the client.
For special cases one can still use HttpClient.executeOpen(HttpHost, ClassicHttpRequest, HttpContext)
to keep the response object open after the request execution.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 abortedexecute(ClassicHttpRequest, HttpContext, HttpClientResponseHandler)
,
HttpClient.executeOpen(HttpHost, ClassicHttpRequest, HttpContext)
@Deprecated public CloseableHttpResponse execute(org.apache.hc.core5.http.ClassicHttpRequest request) throws IOException
HttpClientResponseHandler
such as execute(ClassicHttpRequest, HttpClientResponseHandler)
in order
to ensure automatic resource deallocation by the client.
For special cases one can still use HttpClient.executeOpen(HttpHost, ClassicHttpRequest, HttpContext)
to keep the response object open after the request execution.HttpClient
execute
in interface HttpClient
request
- the request to executeIOException
- in case of a problem or the connection was abortedexecute(ClassicHttpRequest, HttpClientResponseHandler)
,
HttpClient.executeOpen(HttpHost, ClassicHttpRequest, HttpContext)
@Deprecated public CloseableHttpResponse execute(org.apache.hc.core5.http.HttpHost target, org.apache.hc.core5.http.ClassicHttpRequest request) throws IOException
HttpClientResponseHandler
such as execute(HttpHost, ClassicHttpRequest, HttpClientResponseHandler)
in order
to ensure automatic resource deallocation by the client.
For special cases one can still use HttpClient.executeOpen(HttpHost, ClassicHttpRequest, HttpContext)
to keep the response object open after the request execution.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 abortedexecute(HttpHost, ClassicHttpRequest, HttpClientResponseHandler)
,
HttpClient.executeOpen(HttpHost, ClassicHttpRequest, HttpContext)
public <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
T
- the type of the value determined by the response.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
T
- the type of the value determined by the response.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
T
- the type of the value determined by the response.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
T
- the type of the value determined by the response.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–2021 The Apache Software Foundation. All rights reserved.