Top Description Methods
org.springframework.http

public Interface ReactiveHttpOutputMessage

extends HttpMessage
Known Direct Subinterfaces
org.springframework.http.ZeroCopyHttpOutputMessage, org.springframework.http.client.reactive.ClientHttpRequest, org.springframework.http.server.reactive.ServerHttpResponse
Known Direct Implementers
org.springframework.http.codec.multipart.MultipartHttpMessageWriter.MultipartHttpOutputMessage
Imports
java.util.function.Supplier, org.reactivestreams.Publisher, reactor.core.publisher.Mono, org.springframework.core.io.buffer.DataBuffer, .DataBufferFactory

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.

Authors
Arjen Poutsma, Sebastien Deleuze
Since
5.0

Method Summary

Modifier and TypeMethod and Description
public void
beforeCommit(Supplier<? extends Mono<Void>>
the action to apply
action
)

Register an action to apply just before the HttpOutputMessage is committed.

public DataBufferFactory

Returns:

a buffer factory
bufferFactory
()

Return a DataBufferFactory that can be used to create the body.

public boolean
isCommitted()

Whether the HttpOutputMessage is committed.

public Mono<Void>

Returns:

a Mono that indicates completion or error
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 via getHeaders() to the underlying HTTP message (if not applied already).

public Mono<Void>

Returns:

a Mono that indicates completion or error
writeAndFlushWith
(Publisher<? extends Publisher<? extends DataBuffer>>
the body content publisher
body
)

Use the given Publisher of Publishers to write the body of the HttpOutputMessage to the underlying HTTP layer, flushing after each Publisher<DataBuffer>.

public Mono<Void>

Returns:

a Mono that indicates completion or error
writeWith
(Publisher<? extends DataBuffer>
the body content publisher
body
)

Use the given Publisher to write the body of the message to the underlying HTTP layer.

Inherited from org.springframework.http.HttpMessage:
getHeaders

Method Detail

beforeCommitback to summary
public void beforeCommit(Supplier<? extends Mono<Void>> action)

Register an action to apply just before the HttpOutputMessage is committed.

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.

Parameters
action:Supplier<? extends Mono<Void>>

the action to apply

bufferFactoryback to summary
public DataBufferFactory bufferFactory()

Return a DataBufferFactory that can be used to create the body.

Returns:DataBufferFactory

a buffer factory

See Also
writeWith(Publisher)
isCommittedback to summary
public boolean isCommitted()

Whether the HttpOutputMessage is committed.

setCompleteback to summary
public 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 via 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:Mono<Void>

a Mono that indicates completion or error

writeAndFlushWithback to summary
public Mono<Void> writeAndFlushWith(Publisher<? extends Publisher<? extends DataBuffer>> body)

Use the given Publisher of Publishers to write the body of the HttpOutputMessage to the underlying HTTP layer, flushing after each Publisher<DataBuffer>.

Parameters
body:Publisher<? extends Publisher<? extends DataBuffer>>

the body content publisher

Returns:Mono<Void>

a Mono that indicates completion or error

writeWithback to summary
public Mono<Void> writeWith(Publisher<? extends DataBuffer> body)

Use the given Publisher to write the body of the message to the underlying HTTP layer.

Parameters
body:Publisher<? extends DataBuffer>

the body content publisher

Returns:Mono<Void>

a Mono that indicates completion or error