Package org.springframework.http
Interface ReactiveHttpOutputMessage
- All Superinterfaces:
HttpMessage
- All Known Subinterfaces:
ClientHttpRequest
,ServerHttpResponse
,ZeroCopyHttpOutputMessage
- All Known Implementing Classes:
AbstractClientHttpRequest
,AbstractListenerServerHttpResponse
,AbstractServerHttpResponse
,ClientHttpRequestDecorator
,HttpHeadResponseDecorator
,MockClientHttpRequest
,MockServerHttpResponse
,ServerHttpResponseDecorator
A "reactive" HTTP output message that accepts output as a
Publisher
.
Typically implemented by an HTTP request on the client-side or an HTTP response on the server-side.
- Since:
- 5.0
- Author:
- Arjen Poutsma, Sebastien Deleuze
-
Method Summary
Modifier and TypeMethodDescriptionvoid
beforeCommit
(Supplier<? extends reactor.core.publisher.Mono<Void>> action) Register an action to apply just before the HttpOutputMessage is committed.Return aDataBufferFactory
that can be used to create the body.boolean
Whether the HttpOutputMessage is committed.reactor.core.publisher.Mono<Void>
Indicate that message handling is complete, allowing for any cleanup or end-of-processing tasks to be performed such as applying header changes made viaHttpMessage.getHeaders()
to the underlying HTTP message (if not applied already).reactor.core.publisher.Mono<Void>
writeAndFlushWith
(Publisher<? extends Publisher<? extends DataBuffer>> body) Use the givenPublisher
ofPublishers
to write the body of the HttpOutputMessage to the underlying HTTP layer, flushing after eachPublisher<DataBuffer>
.reactor.core.publisher.Mono<Void>
writeWith
(Publisher<? extends DataBuffer> body) Use the givenPublisher
to write the body of the message to the underlying HTTP layer.Methods inherited from interface org.springframework.http.HttpMessage
getHeaders
-
Method Details
-
bufferFactory
DataBufferFactory bufferFactory()Return aDataBufferFactory
that can be used to create the body.- Returns:
- a buffer factory
- See Also:
-
beforeCommit
Register an action to apply just before the HttpOutputMessage is committed.Note: the supplied action must be properly deferred, for example, via
Mono.defer(java.util.function.Supplier<? extends reactor.core.publisher.Mono<? extends T>>)
orMono.fromRunnable(java.lang.Runnable)
, to ensure it's executed in the right order, relative to other actions.- Parameters:
action
- the action to apply
-
isCommitted
boolean isCommitted()Whether the HttpOutputMessage is committed. -
writeWith
Use the givenPublisher
to write the body of the message to the underlying HTTP layer.- Parameters:
body
- the body content publisher- Returns:
- a
Mono
that indicates completion or error
-
writeAndFlushWith
reactor.core.publisher.Mono<Void> writeAndFlushWith(Publisher<? extends Publisher<? extends DataBuffer>> body) Use the givenPublisher
ofPublishers
to write the body of the HttpOutputMessage to the underlying HTTP layer, flushing after eachPublisher<DataBuffer>
.- Parameters:
body
- the body content publisher- Returns:
- a
Mono
that indicates completion or error
-
setComplete
reactor.core.publisher.Mono<Void> setComplete()Indicate that message handling is complete, allowing for any cleanup or end-of-processing tasks to be performed such as applying header changes made viaHttpMessage.getHeaders()
to the underlying HTTP message (if not applied already).This method should be automatically invoked at the end of message processing so typically applications should not have to invoke it. If invoked multiple times it should have no side effects.
- Returns:
- a
Mono
that indicates completion or error
-