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

public abstract Class AbstractClientHttpRequest

extends Object
implements ClientHttpRequest
Class Inheritance
All Implemented Interfaces
org.springframework.http.client.ClientHttpRequest, org.springframework.http.HttpOutputMessage, org.springframework.http.HttpMessage, org.springframework.http.HttpRequest
Known Direct Subclasses
org.springframework.http.client.AbstractStreamingClientHttpRequest, org.springframework.http.client.AbstractBufferingClientHttpRequest
Imports
java.io.IOException, .OutputStream, org.springframework.http.HttpHeaders, org.springframework.lang.Nullable, org.springframework.util.Assert

Abstract base for ClientHttpRequest that makes sure that headers and body are not written multiple times.
Author
Arjen Poutsma
Since
3.0

Field Summary

Modifier and TypeField and Description
private boolean
private final HttpHeaders
private HttpHeaders

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
protected void
assertNotExecuted()

Assert that this request has not been executed yet.

public final ClientHttpResponse
execute()

Implements org.springframework.http.client.ClientHttpRequest.execute.

Execute this request, resulting in a ClientHttpResponse that can be read.
protected abstract ClientHttpResponse

Returns:

the response object for the executed request
executeInternal
(HttpHeaders
the HTTP headers
headers
)

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

public final OutputStream
getBody()

Implements org.springframework.http.HttpOutputMessage.getBody.

Return the body of the message as an output stream.
protected abstract OutputStream

Returns:

the body output stream
getBodyInternal
(HttpHeaders
the HTTP headers
headers
)

Abstract template method that returns the body.

public final HttpHeaders
getHeaders()

Implements org.springframework.http.HttpMessage.getHeaders.

Return the headers of this message.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

executedback to summary
private boolean executed
headersback to summary
private final HttpHeaders headers
readOnlyHeadersback to summary
private HttpHeaders readOnlyHeaders
Annotations
@Nullable

Constructor Detail

AbstractClientHttpRequestback to summary
public AbstractClientHttpRequest()

Method Detail

assertNotExecutedback to summary
protected void assertNotExecuted()

Assert that this request has not been executed yet.

Exceptions
IllegalStateException:
if this request has been executed
executeback to summary
public final ClientHttpResponse execute() throws IOException

Implements org.springframework.http.client.ClientHttpRequest.execute.

Doc from org.springframework.http.client.ClientHttpRequest.execute.

Execute this request, resulting in a ClientHttpResponse that can be read.

Returns:ClientHttpResponse

the response result of the execution

Annotations
@Override
Exceptions
IOException:
in case of I/O errors
executeInternalback to summary
protected abstract ClientHttpResponse executeInternal(HttpHeaders headers) throws IOException

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

Parameters
headers:HttpHeaders

the HTTP headers

Returns:ClientHttpResponse

the response object for the executed request

getBodyback to summary
public final OutputStream getBody() throws IOException

Implements org.springframework.http.HttpOutputMessage.getBody.

Doc from org.springframework.http.HttpOutputMessage.getBody.

Return the body of the message as an output stream.

Returns:OutputStream

the output stream body (never null)

Annotations
@Override
Exceptions
IOException:
in case of I/O errors
getBodyInternalback to summary
protected abstract OutputStream getBodyInternal(HttpHeaders headers) throws IOException

Abstract template method that returns the body.

Parameters
headers:HttpHeaders

the HTTP headers

Returns:OutputStream

the body output stream

getHeadersback to summary
public final HttpHeaders getHeaders()

Implements org.springframework.http.HttpMessage.getHeaders.

Doc from org.springframework.http.HttpMessage.getHeaders.

Return the headers of this message.

Returns:HttpHeaders

a corresponding HttpHeaders object (never null)

Annotations
@Override