abstract class AbstractAsyncClientHttpRequest extends java.lang.Object implements AsyncClientHttpRequest
AsyncClientHttpRequest
that makes sure that headers and body
are not written multiple times.Modifier and Type | Field and Description |
---|---|
private boolean |
executed |
private HttpHeaders |
headers |
Constructor and Description |
---|
AbstractAsyncClientHttpRequest() |
Modifier and Type | Method and Description |
---|---|
protected void |
assertNotExecuted()
Asserts that this request has not been executed yet.
|
ListenableFuture<ClientHttpResponse> |
executeAsync()
Execute this request asynchronously, resulting in a Future handle.
|
protected abstract ListenableFuture<ClientHttpResponse> |
executeInternal(HttpHeaders headers)
Abstract template method that writes the given headers and content to the HTTP request.
|
java.io.OutputStream |
getBody()
Return the body of the message as an output stream.
|
protected abstract java.io.OutputStream |
getBodyInternal(HttpHeaders headers)
Abstract template method that returns the body.
|
HttpHeaders |
getHeaders()
Return the headers of this message.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getMethod, getURI
private final HttpHeaders headers
private boolean executed
public final HttpHeaders getHeaders()
HttpMessage
getHeaders
in interface HttpMessage
null
)public final java.io.OutputStream getBody() throws java.io.IOException
HttpOutputMessage
getBody
in interface HttpOutputMessage
null
)java.io.IOException
- in case of I/O Errorspublic ListenableFuture<ClientHttpResponse> executeAsync() throws java.io.IOException
AsyncClientHttpRequest
ClientHttpResponse
that can be read.executeAsync
in interface AsyncClientHttpRequest
java.io.IOException
- in case of I/O errorsprotected void assertNotExecuted()
java.lang.IllegalStateException
- if this request has been executedprotected abstract java.io.OutputStream getBodyInternal(HttpHeaders headers) throws java.io.IOException
headers
- the HTTP headersjava.io.IOException
protected abstract ListenableFuture<ClientHttpResponse> executeInternal(HttpHeaders headers) throws java.io.IOException
headers
- the HTTP headersjava.io.IOException