public abstract class AbstractClientHttpRequest extends Object implements ClientHttpRequest
ClientHttpRequest
implementations.Constructor and Description |
---|
AbstractClientHttpRequest() |
AbstractClientHttpRequest(HttpHeaders headers) |
Modifier and Type | Method and Description |
---|---|
protected abstract void |
applyCookies()
Add cookies from
getHeaders() to the underlying request. |
protected abstract void |
applyHeaders()
Apply header changes from
getHeaders() to the underlying request. |
void |
beforeCommit(Supplier<? extends reactor.core.publisher.Mono<Void>> action)
Register an action to apply just before the HttpOutputMessage is committed.
|
protected reactor.core.publisher.Mono<Void> |
doCommit()
A variant of
doCommit(Supplier) for a request without body. |
protected reactor.core.publisher.Mono<Void> |
doCommit(Supplier<? extends Publisher<Void>> writeAction)
Apply
beforeCommit actions, apply the
request headers/cookies, and write the request body. |
MultiValueMap<String,HttpCookie> |
getCookies()
Return a mutable map of request cookies to send to the server.
|
HttpHeaders |
getHeaders()
Return the headers of this message.
|
protected HttpHeaders |
initReadOnlyHeaders()
Initialize the read-only headers after the request is committed.
|
boolean |
isCommitted()
Whether the HttpOutputMessage is committed.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getMethod, getNativeRequest, getURI
bufferFactory, setComplete, writeAndFlushWith, writeWith
public AbstractClientHttpRequest()
public AbstractClientHttpRequest(HttpHeaders headers)
public HttpHeaders getHeaders()
HttpMessage
getHeaders
in interface HttpMessage
null
)protected HttpHeaders initReadOnlyHeaders()
By default, this method simply applies a read-only wrapper. Subclasses can do the same for headers from the native request.
public MultiValueMap<String,HttpCookie> getCookies()
ClientHttpRequest
getCookies
in interface ClientHttpRequest
public void beforeCommit(Supplier<? extends reactor.core.publisher.Mono<Void>> action)
ReactiveHttpOutputMessage
Note: the supplied action must be properly deferred,
e.g. via Mono.defer(java.util.function.Supplier<? extends reactor.core.publisher.Mono<? extends T>>)
or Mono.fromRunnable(java.lang.Runnable)
, 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 reactor.core.publisher.Mono<Void> doCommit()
doCommit(Supplier)
for a request without body.protected reactor.core.publisher.Mono<Void> doCommit(@Nullable Supplier<? extends Publisher<Void>> 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 request.
This method is called once only.protected abstract void applyCookies()
getHeaders()
to the underlying request.
This method is called once only.