final class HttpComponentsClientHttpRequest extends AbstractBufferingClientHttpRequest
ClientHttpRequest implementation that uses
Apache HttpComponents HttpClient to execute requests.
Created via the HttpComponentsClientHttpRequestFactory.
NOTE: Requires Apache HttpComponents 4.3 or higher, as of Spring 4.0.
HttpComponentsClientHttpRequestFactory.createRequest(URI, HttpMethod)| Modifier and Type | Field and Description |
|---|---|
private HttpClient |
httpClient |
private HttpContext |
httpContext |
private HttpUriRequest |
httpRequest |
| Constructor and Description |
|---|
HttpComponentsClientHttpRequest(HttpClient httpClient,
HttpUriRequest httpRequest,
HttpContext httpContext) |
| Modifier and Type | Method and Description |
|---|---|
(package private) static void |
addHeaders(HttpUriRequest httpRequest,
HttpHeaders headers)
Add the given headers to the given HTTP request.
|
protected ClientHttpResponse |
executeInternal(HttpHeaders headers,
byte[] bufferedOutput)
Abstract template method that writes the given headers and content to the HTTP request.
|
(package private) HttpContext |
getHttpContext() |
HttpMethod |
getMethod()
Return the HTTP method of the request.
|
java.net.URI |
getURI()
Return the URI of the request.
|
executeInternal, getBodyInternalassertNotExecuted, execute, getBody, getHeadersprivate final HttpClient httpClient
private final HttpUriRequest httpRequest
private final HttpContext httpContext
HttpComponentsClientHttpRequest(HttpClient httpClient,
HttpUriRequest httpRequest,
HttpContext httpContext)
public HttpMethod getMethod()
HttpRequestnull
if not resolvable (e.g. in case of a non-standard HTTP method)public java.net.URI getURI()
HttpRequestnull)HttpContext getHttpContext()
protected ClientHttpResponse executeInternal(HttpHeaders headers, byte[] bufferedOutput) throws java.io.IOException
AbstractBufferingClientHttpRequestexecuteInternal in class AbstractBufferingClientHttpRequestheaders - the HTTP headersbufferedOutput - the body contentjava.io.IOExceptionstatic void addHeaders(HttpUriRequest httpRequest,
HttpHeaders headers)
httpRequest - the request to add the headers toheaders - the headers to add