Class AbstractClientHttpRequest
java.lang.Object
org.springframework.http.client.reactive.AbstractClientHttpRequest
- All Implemented Interfaces:
- ClientHttpRequest, HttpMessage, ReactiveHttpOutputMessage
- Direct Known Subclasses:
- MockClientHttpRequest
Base class for 
ClientHttpRequest implementations.- Since:
- 5.0
- Author:
- Rossen Stoyanchev, Brian Clozel
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionprotected voidAdd attributes fromgetAttributes()to the underlying request.protected abstract voidAdd cookies fromgetHeaders()to the underlying request.protected abstract voidApply header changes fromgetHeaders()to the underlying request.voidbeforeCommit(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 ofdoCommit(Supplier)for a request without body.protected reactor.core.publisher.Mono<Void> ApplybeforeCommitactions, apply the request headers/cookies, and write the request body.Return a mutable map of the request attributes.Return a mutable map of request cookies to send to the server.Return the headers of this message.protected HttpHeadersInitialize the read-only headers after the request is committed.booleanWhether the HttpOutputMessage is committed.Methods inherited from class Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface ClientHttpRequestgetMethod, getNativeRequest, getURIMethods inherited from interface ReactiveHttpOutputMessagebufferFactory, setComplete, writeAndFlushWith, writeWith
- 
Constructor Details- 
AbstractClientHttpRequestpublic AbstractClientHttpRequest()
- 
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)
 
- 
initReadOnlyHeadersInitialize the read-only headers after the request is committed.By default, this method simply applies a read-only wrapper. Subclasses can do the same for headers from the native request. - Since:
- 5.3.15
 
- 
getCookiesDescription copied from interface:ClientHttpRequestReturn a mutable map of request cookies to send to the server.- Specified by:
- getCookiesin interface- ClientHttpRequest
 
- 
getAttributesDescription copied from interface:ClientHttpRequestReturn a mutable map of the request attributes.- Specified by:
- getAttributesin interface- ClientHttpRequest
 
- 
beforeCommitDescription copied from interface:ReactiveHttpOutputMessageRegister an action to apply just before the HttpOutputMessage is committed.Note: the supplied action must be properly deferred, for example, via Mono.defer(Supplier)orMono.fromRunnable(Runnable), to ensure it's executed in the right order, relative to other actions.- Specified by:
- beforeCommitin interface- ReactiveHttpOutputMessage
- Parameters:
- action- the action to apply
 
- 
isCommittedpublic boolean isCommitted()Description copied from interface:ReactiveHttpOutputMessageWhether the HttpOutputMessage is committed.- Specified by:
- isCommittedin interface- ReactiveHttpOutputMessage
 
- 
doCommitA variant ofdoCommit(Supplier)for a request without body.- Returns:
- a completion publisher
 
- 
doCommitprotected reactor.core.publisher.Mono<Void> doCommit(@Nullable Supplier<? extends Publisher<Void>> writeAction) ApplybeforeCommitactions, apply the request headers/cookies, and write the request body.- Parameters:
- writeAction- the action to write the request body (may be- null)
- Returns:
- a completion publisher
 
- 
applyHeadersprotected abstract void applyHeaders()Apply header changes fromgetHeaders()to the underlying request. This method is called once only.
- 
applyCookiesprotected abstract void applyCookies()Add cookies fromgetHeaders()to the underlying request. This method is called once only.
- 
applyAttributesprotected void applyAttributes()Add attributes fromgetAttributes()to the underlying request. This method is called once only.- Since:
- 6.2
 
 
-