Top Description Fields Constructors Methods
org.springframework.http.server.reactive

public Class ServerHttpResponseDecorator

extends Object
implements ServerHttpResponse
Class Inheritance
All Implemented Interfaces
org.springframework.http.server.reactive.ServerHttpResponse, org.springframework.http.ReactiveHttpOutputMessage, org.springframework.http.HttpMessage
Known Direct Subclasses
org.springframework.http.server.reactive.HttpHeadResponseDecorator
Imports
java.util.function.Supplier, org.reactivestreams.Publisher, reactor.core.publisher.Mono, org.springframework.core.io.buffer.DataBuffer, .DataBufferFactory, org.springframework.http.HttpHeaders, .HttpStatusCode, .ResponseCookie, org.springframework.lang.Nullable, org.springframework.util.Assert, .MultiValueMap

Wraps another ServerHttpResponse and delegates all methods to it. Subclasses can override specific methods selectively.
Author
Rossen Stoyanchev
Since
5.0

Field Summary

Modifier and TypeField and Description
private final ServerHttpResponse

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public void
addCookie(ResponseCookie
the cookie to add
cookie
)

Implements org.springframework.http.server.reactive.ServerHttpResponse.addCookie.

Add the given ResponseCookie.

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

Implements org.springframework.http.ReactiveHttpOutputMessage.beforeCommit.

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

public DataBufferFactory
public MultiValueMap<String, ResponseCookie>
getCookies()

Implements org.springframework.http.server.reactive.ServerHttpResponse.getCookies.

Return a mutable map with the cookies to send to the server.

public ServerHttpResponse
public HttpHeaders
getHeaders()

Implements org.springframework.http.HttpMessage.getHeaders.

Return the headers of this message.

public static <
the expected native response type
T
>
T
getNativeResponse(ServerHttpResponse
the response to check
response
)

Return the native response of the underlying server API, if possible, also unwrapping ServerHttpResponseDecorator if necessary.

public Integer
getRawStatusCode()

Overrides default org.springframework.http.server.reactive.ServerHttpResponse.getRawStatusCode.

Deprecated

Return the status code that has been set, or otherwise fall back on the status of the response from the underlying server.

public HttpStatusCode
getStatusCode()

Implements org.springframework.http.server.reactive.ServerHttpResponse.getStatusCode.

Return the status code that has been set, or otherwise fall back on the status of the response from the underlying server.

public boolean
isCommitted()

Implements org.springframework.http.ReactiveHttpOutputMessage.isCommitted.

Whether the HttpOutputMessage is committed.

public Mono<Void>
setComplete()

Implements org.springframework.http.ReactiveHttpOutputMessage.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 boolean
setRawStatusCode(Integer
the status code value
value
)

Overrides default org.springframework.http.server.reactive.ServerHttpResponse.setRawStatusCode.

Set the HTTP status code to the given value as an integer.

public boolean
setStatusCode(HttpStatusCode
the HTTP status as an HttpStatusCode value
status
)

Implements org.springframework.http.server.reactive.ServerHttpResponse.setStatusCode.

Set the HTTP status code of the response.

public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.

public Mono<Void>
writeAndFlushWith(Publisher<? extends Publisher<? extends DataBuffer>>
the body content publisher
body
)

Implements org.springframework.http.ReactiveHttpOutputMessage.writeAndFlushWith.

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>
writeWith(Publisher<? extends DataBuffer>
the body content publisher
body
)

Implements org.springframework.http.ReactiveHttpOutputMessage.writeWith.

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

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

delegateback to summary
private final ServerHttpResponse delegate

Constructor Detail

ServerHttpResponseDecoratorback to summary
public ServerHttpResponseDecorator(ServerHttpResponse delegate)

Method Detail

addCookieback to summary
public void addCookie(ResponseCookie cookie)

Implements org.springframework.http.server.reactive.ServerHttpResponse.addCookie.

Doc from org.springframework.http.server.reactive.ServerHttpResponse.addCookie.

Add the given ResponseCookie.

Parameters
cookie:ResponseCookie

the cookie to add

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

Implements org.springframework.http.ReactiveHttpOutputMessage.beforeCommit.

Doc from org.springframework.http.ReactiveHttpOutputMessage.beforeCommit.

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

Annotations
@Override
bufferFactoryback to summary
public DataBufferFactory bufferFactory()

Implements org.springframework.http.ReactiveHttpOutputMessage.bufferFactory.

Doc from org.springframework.http.ReactiveHttpOutputMessage.bufferFactory.

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

Returns:DataBufferFactory

a buffer factory

Annotations
@Override
getCookiesback to summary
public MultiValueMap<String, ResponseCookie> getCookies()

Implements org.springframework.http.server.reactive.ServerHttpResponse.getCookies.

Doc from org.springframework.http.server.reactive.ServerHttpResponse.getCookies.

Return a mutable map with the cookies to send to the server.

Annotations
@Override
getDelegateback to summary
public ServerHttpResponse getDelegate()
getHeadersback to summary
public HttpHeaders getHeaders()

Implements org.springframework.http.HttpMessage.getHeaders.

Doc from org.springframework.http.HttpMessage.getHeaders.

Return the headers of this message.

Returns:HttpHeaders

a corresponding HttpHeaders object (never null)

Annotations
@Override
getNativeResponseback to summary
public static <T> T getNativeResponse(ServerHttpResponse response)

Return the native response of the underlying server API, if possible, also unwrapping ServerHttpResponseDecorator if necessary.

Parameters
<T>
the expected native response type
response:ServerHttpResponse

the response to check

Exceptions
IllegalArgumentException:
if the native response can't be obtained
Since
5.3.3
getRawStatusCodeback to summary
public Integer getRawStatusCode()

Overrides default org.springframework.http.server.reactive.ServerHttpResponse.getRawStatusCode.

Doc from org.springframework.http.server.reactive.ServerHttpResponse.getRawStatusCode.

Deprecated

Return the status code that has been set, or otherwise fall back on the status of the response from the underlying server. The return value may be null if there is no default value from the underlying server.

Annotations
@Override
@Deprecated
getStatusCodeback to summary
public HttpStatusCode getStatusCode()

Implements org.springframework.http.server.reactive.ServerHttpResponse.getStatusCode.

Doc from org.springframework.http.server.reactive.ServerHttpResponse.getStatusCode.

Return the status code that has been set, or otherwise fall back on the status of the response from the underlying server. The return value may be null if there is no default value from the underlying server.

Annotations
@Override
isCommittedback to summary
public boolean isCommitted()

Implements org.springframework.http.ReactiveHttpOutputMessage.isCommitted.

Doc from org.springframework.http.ReactiveHttpOutputMessage.isCommitted.

Whether the HttpOutputMessage is committed.

Annotations
@Override
setCompleteback to summary
public Mono<Void> setComplete()

Implements org.springframework.http.ReactiveHttpOutputMessage.setComplete.

Doc from org.springframework.http.ReactiveHttpOutputMessage.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

Annotations
@Override
setRawStatusCodeback to summary
public boolean setRawStatusCode(Integer value)

Overrides default org.springframework.http.server.reactive.ServerHttpResponse.setRawStatusCode.

Doc from org.springframework.http.server.reactive.ServerHttpResponse.setRawStatusCode.

Set the HTTP status code to the given value as an integer.

Parameters
value:Integer

the status code value

Returns:boolean

false if the status code change wasn't processed because the HTTP response is committed, true if successfully set.

Annotations
@Override
setStatusCodeback to summary
public boolean setStatusCode(HttpStatusCode status)

Implements org.springframework.http.server.reactive.ServerHttpResponse.setStatusCode.

Doc from org.springframework.http.server.reactive.ServerHttpResponse.setStatusCode.

Set the HTTP status code of the response.

Parameters
status:HttpStatusCode

the HTTP status as an HttpStatusCode value

Returns:boolean

false if the status code change wasn't processed because the HTTP response is committed, true if successfully set.

Annotations
@Override
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object. Satisfying this method's contract implies a non-null result must be returned.

Returns:String

a string representation of the object

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

Implements org.springframework.http.ReactiveHttpOutputMessage.writeAndFlushWith.

Doc from org.springframework.http.ReactiveHttpOutputMessage.writeAndFlushWith.

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

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

Implements org.springframework.http.ReactiveHttpOutputMessage.writeWith.

Doc from org.springframework.http.ReactiveHttpOutputMessage.writeWith.

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

Annotations
@Override