public abstract class AbstractServerHttpResponse extends Object implements ServerHttpResponse
ServerHttpResponse implementations.| Constructor and Description | 
|---|
| AbstractServerHttpResponse(DataBufferFactory dataBufferFactory) | 
| AbstractServerHttpResponse(DataBufferFactory dataBufferFactory,
                          HttpHeaders headers) | 
| Modifier and Type | Method and Description | 
|---|---|
| void | addCookie(ResponseCookie cookie)Add the given  ResponseCookie. | 
| protected abstract void | applyCookies()Add cookies from  getHeaders()to the underlying response. | 
| protected abstract void | applyHeaders()Invoked when the response is getting committed allowing sub-classes to
 make apply header values to the underlying response. | 
| protected abstract void | applyStatusCode()Write the status code to the underlying response. | 
| void | beforeCommit(Supplier<? extends reactor.core.publisher.Mono<Void>> action)Register an action to apply just before the HttpOutputMessage is committed. | 
| DataBufferFactory | bufferFactory()Return a  DataBufferFactorythat can be used to create the body. | 
| protected reactor.core.publisher.Mono<Void> | doCommit()A variant of  doCommit(Supplier)for a response without no body. | 
| protected reactor.core.publisher.Mono<Void> | doCommit(Supplier<? extends reactor.core.publisher.Mono<Void>> writeAction)Apply  beforeCommitactions, apply the
 response status and headers/cookies, and write the response body. | 
| MultiValueMap<String,ResponseCookie> | getCookies()Return a mutable map with the cookies to send to the server. | 
| HttpHeaders | getHeaders()Return the headers of this message. | 
| abstract <T> T | getNativeResponse()Return the underlying server response. | 
| Integer | getRawStatusCode()Return the status code that has been set, or otherwise fall back on the
 status of the response from the underlying server. | 
| HttpStatus | getStatusCode()Return the status code that has been set, or otherwise fall back on the
 status of the response from the underlying server. | 
| Integer | getStatusCodeValue()Deprecated. 
 as of 5.2.4 in favor of  ServerHttpResponse.getRawStatusCode(). | 
| boolean | isCommitted()Whether the HttpOutputMessage is committed. | 
| 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 via  HttpMessage.getHeaders()to the underlying HTTP message (if not
 applied already). | 
| boolean | setRawStatusCode(Integer statusCode)Set the HTTP status code to the given value (potentially non-standard and
 not resolvable through the  HttpStatusenum) as an integer. | 
| boolean | setStatusCode(HttpStatus status)Set the HTTP status code of the response. | 
| void | setStatusCodeValue(Integer statusCode)Deprecated. 
 as of 5.2.4 in favor of  ServerHttpResponse.setRawStatusCode(Integer). | 
| protected void | touchDataBuffer(DataBuffer buffer)Allow sub-classes to associate a hint with the data buffer if it is a
 pooled buffer and supports leak tracking. | 
| reactor.core.publisher.Mono<Void> | writeAndFlushWith(Publisher<? extends Publisher<? extends DataBuffer>> body)Use the given  PublisherofPublishersto write the body
 of the HttpOutputMessage to the underlying HTTP layer, flushing after
 eachPublisher<DataBuffer>. | 
| protected abstract reactor.core.publisher.Mono<Void> | writeAndFlushWithInternal(Publisher<? extends Publisher<? extends DataBuffer>> body)Write to the underlying the response, and flush after each  Publisher<DataBuffer>. | 
| reactor.core.publisher.Mono<Void> | writeWith(Publisher<? extends DataBuffer> body)Use the given  Publisherto write the body of the message to the
 underlying HTTP layer. | 
| protected abstract reactor.core.publisher.Mono<Void> | writeWithInternal(Publisher<? extends DataBuffer> body)Write to the underlying the response. | 
public AbstractServerHttpResponse(DataBufferFactory dataBufferFactory)
public AbstractServerHttpResponse(DataBufferFactory dataBufferFactory, HttpHeaders headers)
public final DataBufferFactory bufferFactory()
ReactiveHttpOutputMessageDataBufferFactory that can be used to create the body.bufferFactory in interface ReactiveHttpOutputMessageReactiveHttpOutputMessage.writeWith(Publisher)public boolean setStatusCode(@Nullable HttpStatus status)
ServerHttpResponsesetStatusCode in interface ServerHttpResponsestatus - the HTTP status as an HttpStatus enum valuefalse if the status code change wasn't processed because
 the HTTP response is committed, true if successfully set.@Nullable public HttpStatus getStatusCode()
ServerHttpResponsenull if the status code value is outside the
 HttpStatus enum range, or if there is no default value from the
 underlying server.getStatusCode in interface ServerHttpResponsepublic boolean setRawStatusCode(@Nullable Integer statusCode)
ServerHttpResponseHttpStatus enum) as an integer.setRawStatusCode in interface ServerHttpResponsestatusCode - the status code valuefalse if the status code change wasn't processed because
 the HTTP response is committed, true if successfully set.@Nullable public Integer getRawStatusCode()
ServerHttpResponsenull if there is no default value from the underlying server.getRawStatusCode in interface ServerHttpResponse@Deprecated public void setStatusCodeValue(@Nullable Integer statusCode)
ServerHttpResponse.setRawStatusCode(Integer).statusCode - the HTTP status as an integer value@Nullable @Deprecated public Integer getStatusCodeValue()
ServerHttpResponse.getRawStatusCode().public HttpHeaders getHeaders()
HttpMessagegetHeaders in interface HttpMessagenull)public MultiValueMap<String,ResponseCookie> getCookies()
ServerHttpResponsegetCookies in interface ServerHttpResponsepublic void addCookie(ResponseCookie cookie)
ServerHttpResponseResponseCookie.addCookie in interface ServerHttpResponsecookie - the cookie to addpublic abstract <T> T getNativeResponse()
Note: This is exposed mainly for internal framework use such as WebSocket upgrades in the spring-webflux module.
public void beforeCommit(Supplier<? extends reactor.core.publisher.Mono<Void>> action)
ReactiveHttpOutputMessageNote: 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 ReactiveHttpOutputMessageaction - the action to applypublic boolean isCommitted()
ReactiveHttpOutputMessageisCommitted in interface ReactiveHttpOutputMessagepublic final reactor.core.publisher.Mono<Void> writeWith(Publisher<? extends DataBuffer> body)
ReactiveHttpOutputMessagePublisher to write the body of the message to the
 underlying HTTP layer.writeWith in interface ReactiveHttpOutputMessagebody - the body content publisherMono that indicates completion or errorpublic final reactor.core.publisher.Mono<Void> writeAndFlushWith(Publisher<? extends Publisher<? extends DataBuffer>> body)
ReactiveHttpOutputMessagePublisher of Publishers to write the body
 of the HttpOutputMessage to the underlying HTTP layer, flushing after
 each Publisher<DataBuffer>.writeAndFlushWith in interface ReactiveHttpOutputMessagebody - the body content publisherMono that indicates completion or errorpublic reactor.core.publisher.Mono<Void> setComplete()
ReactiveHttpOutputMessageHttpMessage.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.
setComplete in interface ReactiveHttpOutputMessageMono that indicates completion or errorprotected reactor.core.publisher.Mono<Void> doCommit()
doCommit(Supplier) for a response without no body.protected reactor.core.publisher.Mono<Void> doCommit(@Nullable Supplier<? extends reactor.core.publisher.Mono<Void>> writeAction)
beforeCommit actions, apply the
 response status and headers/cookies, and write the response body.writeAction - the action to write the response body (may be null)protected abstract reactor.core.publisher.Mono<Void> writeWithInternal(Publisher<? extends DataBuffer> body)
body - the publisher to write withprotected abstract reactor.core.publisher.Mono<Void> writeAndFlushWithInternal(Publisher<? extends Publisher<? extends DataBuffer>> body)
Publisher<DataBuffer>.body - the publisher to write and flush withprotected abstract void applyStatusCode()
protected abstract void applyHeaders()
Note that most sub-classes use an HttpHeaders instance that
 wraps an adapter to the native response headers such that changes are
 propagated to the underlying response on the go. That means this callback
 is typically not used other than for specialized updates such as setting
 the contentType or characterEncoding fields in a Servlet response.
protected abstract void applyCookies()
getHeaders() to the underlying response.
 This method is called once only.protected void touchDataBuffer(DataBuffer buffer)
buffer - the buffer to attach a hint to