Package org.springframework.http.client
Class AbstractClientHttpRequest
java.lang.Object
org.springframework.http.client.AbstractClientHttpRequest
- All Implemented Interfaces:
- ClientHttpRequest,- HttpMessage,- HttpOutputMessage,- HttpRequest
Abstract base for 
ClientHttpRequest that makes sure that headers
 and body are not written multiple times.- Since:
- 3.0
- Author:
- Arjen Poutsma
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionprotected voidAssert that this request has not been executed yet.final ClientHttpResponseexecute()Execute this request, resulting in aClientHttpResponsethat can be read.protected abstract ClientHttpResponseexecuteInternal(HttpHeaders headers) Abstract template method that writes the given headers and content to the HTTP request.final OutputStreamgetBody()Return the body of the message as an output stream.protected abstract OutputStreamgetBodyInternal(HttpHeaders headers) Abstract template method that returns the body.final HttpHeadersReturn the headers of this message.Methods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.springframework.http.HttpRequestgetMethod, getURI
- 
Constructor Details- 
AbstractClientHttpRequestpublic AbstractClientHttpRequest()
 
- 
- 
Method Details- 
getHeadersDescription copied from interface:HttpMessageReturn the headers of this message.- Specified by:
- getHeadersin interface- HttpMessage
- Returns:
- a corresponding HttpHeaders object (never null)
 
- 
getBodyDescription copied from interface:HttpOutputMessageReturn the body of the message as an output stream.- Specified by:
- getBodyin interface- HttpOutputMessage
- Returns:
- the output stream body (never null)
- Throws:
- IOException- in case of I/O errors
 
- 
executeDescription copied from interface:ClientHttpRequestExecute this request, resulting in aClientHttpResponsethat can be read.- Specified by:
- executein interface- ClientHttpRequest
- Returns:
- the response result of the execution
- Throws:
- IOException- in case of I/O errors
 
- 
assertNotExecutedprotected void assertNotExecuted()Assert that this request has not been executed yet.- Throws:
- IllegalStateException- if this request has been executed
 
- 
getBodyInternalAbstract template method that returns the body.- Parameters:
- headers- the HTTP headers
- Returns:
- the body output stream
- Throws:
- IOException
 
- 
executeInternalAbstract template method that writes the given headers and content to the HTTP request.- Parameters:
- headers- the HTTP headers
- Returns:
- the response object for the executed request
- Throws:
- IOException
 
 
-