public abstract class AbstractClientHttpRequest extends java.lang.Object implements ClientHttpRequest
ClientHttpRequest
implementations.Modifier and Type | Class and Description |
---|---|
private static class |
AbstractClientHttpRequest.State
COMMITTING -> COMMITTED is the period after doCommit is called but before
the response status and headers have been applied to the underlying
response during which time pre-commit actions can still make changes to
the response status and headers.
|
Modifier and Type | Field and Description |
---|---|
private java.util.List<java.util.function.Supplier<? extends <any>>> |
commitActions |
private MultiValueMap<java.lang.String,HttpCookie> |
cookies |
private HttpHeaders |
headers |
private java.util.concurrent.atomic.AtomicReference<AbstractClientHttpRequest.State> |
state |
Constructor and Description |
---|
AbstractClientHttpRequest() |
AbstractClientHttpRequest(HttpHeaders headers) |
Modifier and Type | Method and Description |
---|---|
protected abstract void |
applyCookies()
Add cookies from
getHeaders() to the underlying response. |
protected abstract void |
applyHeaders()
Apply header changes from
getHeaders() to the underlying response. |
void |
beforeCommit(java.util.function.Supplier<? extends <any>> action)
Register an action to apply just before the HttpOutputMessage is committed.
|
protected <any> |
doCommit()
A variant of
doCommit(Supplier) for a request without body. |
protected <any> |
doCommit(java.util.function.Supplier<? extends <any>> writeAction)
Apply
beforeCommit actions, apply the
request headers/cookies, and write the request body. |
MultiValueMap<java.lang.String,HttpCookie> |
getCookies()
Return a mutable map of request cookies to send to the server.
|
HttpHeaders |
getHeaders()
Return the headers of this message.
|
boolean |
isCommitted()
Whether the HttpOutputMessage is committed.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getMethod, getURI
bufferFactory, setComplete, writeAndFlushWith, writeWith
private final HttpHeaders headers
private final MultiValueMap<java.lang.String,HttpCookie> cookies
private final java.util.concurrent.atomic.AtomicReference<AbstractClientHttpRequest.State> state
private final java.util.List<java.util.function.Supplier<? extends <any>>> commitActions
public AbstractClientHttpRequest()
public AbstractClientHttpRequest(HttpHeaders headers)
public HttpHeaders getHeaders()
HttpMessage
getHeaders
in interface HttpMessage
null
)public MultiValueMap<java.lang.String,HttpCookie> getCookies()
ClientHttpRequest
getCookies
in interface ClientHttpRequest
public void beforeCommit(java.util.function.Supplier<? extends <any>> action)
ReactiveHttpOutputMessage
Note: the supplied action must be properly deferred,
e.g. via Mono#defer
or Mono#fromRunnable
, to ensure it's
executed in the right order, relative to other actions.
beforeCommit
in interface ReactiveHttpOutputMessage
action
- the action to applypublic boolean isCommitted()
ReactiveHttpOutputMessage
isCommitted
in interface ReactiveHttpOutputMessage
protected <any> doCommit()
doCommit(Supplier)
for a request without body.protected <any> doCommit(@Nullable java.util.function.Supplier<? extends <any>> writeAction)
beforeCommit
actions, apply the
request headers/cookies, and write the request body.writeAction
- the action to write the request body (may be null
)protected abstract void applyHeaders()
getHeaders()
to the underlying response.
This method is called once only.protected abstract void applyCookies()
getHeaders()
to the underlying response.
This method is called once only.