public abstract class

AbstractClientHttpRequest

extends Object
implements ClientHttpRequest
java.lang.Object
   ↳ org.springframework.http.client.AbstractClientHttpRequest
Known Direct Subclasses

Class Overview

Abstract base for ClientHttpRequest that makes sure that headers and body are not written multiple times.

Summary

Public Constructors
AbstractClientHttpRequest()
Public Methods
final ClientHttpResponse execute()
Execute this request, resulting in a ClientHttpResponse that can be read.
final OutputStream getBody()
Return the body of the message as an output stream.
final HttpHeaders getHeaders()
Return the headers of this message.
Protected Methods
abstract ClientHttpResponse executeInternal(HttpHeaders headers)
Abstract template method that writes the given headers and content to the HTTP request.
abstract OutputStream getBodyInternal(HttpHeaders headers)
Abstract template method that returns the body.
[Expand]
Inherited Methods
From class java.lang.Object
From interface org.springframework.http.HttpMessage
From interface org.springframework.http.HttpOutputMessage
From interface org.springframework.http.HttpRequest
From interface org.springframework.http.client.ClientHttpRequest

Public Constructors

public AbstractClientHttpRequest ()

Public Methods

public final ClientHttpResponse execute ()

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

Returns
  • the response result of the execution
Throws
IOException

public final OutputStream getBody ()

Return the body of the message as an output stream.

Returns
  • the output stream body
Throws
IOException

public final HttpHeaders getHeaders ()

Return the headers of this message.

Returns
  • a corresponding HttpHeaders object

Protected Methods

protected abstract ClientHttpResponse executeInternal (HttpHeaders headers)

Abstract 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

protected abstract OutputStream getBodyInternal (HttpHeaders headers)

Abstract template method that returns the body.

Parameters
headers the HTTP headers
Returns
  • the body output stream
Throws
IOException