Top Description Fields Constructors Methods
org.springframework.http.client

pack-priv final Class SimpleClientHttpRequest

extends AbstractStreamingClientHttpRequest
Class Inheritance
Imports
java.io.IOException, .OutputStream, java.net.HttpURLConnection, .URI, .URISyntaxException, org.springframework.http.HttpHeaders, .HttpMethod, org.springframework.lang.Nullable, org.springframework.util.StringUtils

ClientHttpRequest implementation that uses standard JDK facilities to execute streaming requests. Created via the SimpleClientHttpRequestFactory.
Author
Arjen Poutsma
Since
6.1
See Also
SimpleClientHttpRequestFactory#createRequest(URI, HttpMethod)

Field Summary

Modifier and TypeField and Description
private final int
private final HttpURLConnection

Constructor Summary

AccessConstructor and Description
pack-priv
SimpleClientHttpRequest(HttpURLConnection connection, int chunkSize)

Method Summary

Modifier and TypeMethod and Description
pack-priv static void
addHeaders(HttpURLConnection
the connection to add the headers to
connection
,
HttpHeaders
the headers to add
headers
)

Add the given headers to the given HTTP connection.

protected ClientHttpResponse
executeInternal(HttpHeaders
the HTTP headers
headers
,
StreamingHttpOutputMessage.Body
the HTTP body, may be null if no body was set
body
)

Implements abstract org.springframework.http.client.AbstractStreamingClientHttpRequest.executeInternal.

Abstract template method that writes the given headers and content to the HTTP request.

public HttpMethod
getMethod()

Implements org.springframework.http.HttpRequest.getMethod.

Return the HTTP method of the request.

public URI
getURI()

Implements org.springframework.http.HttpRequest.getURI.

Return the URI of the request (including a query string if any, but only if it is well-formed for a URI representation).

Inherited from org.springframework.http.client.AbstractStreamingClientHttpRequest:
executeInternalgetBodyInternalsetBody

Field Detail

chunkSizeback to summary
private final int chunkSize
connectionback to summary
private final HttpURLConnection connection

Constructor Detail

SimpleClientHttpRequestback to summary
pack-priv SimpleClientHttpRequest(HttpURLConnection connection, int chunkSize)

Method Detail

addHeadersback to summary
pack-priv static void addHeaders(HttpURLConnection connection, HttpHeaders headers)

Add the given headers to the given HTTP connection.

Parameters
connection:HttpURLConnection

the connection to add the headers to

headers:HttpHeaders

the headers to add

executeInternalback to summary
protected ClientHttpResponse executeInternal(HttpHeaders headers, StreamingHttpOutputMessage.Body body) throws IOException

Implements abstract org.springframework.http.client.AbstractStreamingClientHttpRequest.executeInternal.

Doc from org.springframework.http.client.AbstractStreamingClientHttpRequest.executeInternal.

Abstract template method that writes the given headers and content to the HTTP request.

Parameters
headers:HttpHeaders

the HTTP headers

body:StreamingHttpOutputMessage.Body

the HTTP body, may be null if no body was set

Returns:ClientHttpResponse

the response object for the executed request

Annotations
@Override
getMethodback to summary
public HttpMethod getMethod()

Implements org.springframework.http.HttpRequest.getMethod.

Doc from org.springframework.http.HttpRequest.getMethod.

Return the HTTP method of the request.

Returns:HttpMethod

the HTTP method as an HttpMethod value

Annotations
@Override
getURIback to summary
public URI getURI()

Implements org.springframework.http.HttpRequest.getURI.

Doc from org.springframework.http.HttpRequest.getURI.

Return the URI of the request (including a query string if any, but only if it is well-formed for a URI representation).

Returns:URI

the URI of the request (never null)

Annotations
@Override