类 ServerHttpResponseDecorator
- java.lang.Object
- org.springframework.http.server.reactive.ServerHttpResponseDecorator
- 直接已知子类:
HttpHeadResponseDecorator
public class ServerHttpResponseDecorator extends Object implements ServerHttpResponse
Wraps anotherServerHttpResponse
and delegates all methods to it. Sub-classes can override specific methods selectively.- 从以下版本开始:
- 5.0
- 作者:
- Rossen Stoyanchev
构造器概要
构造器 构造器 说明 ServerHttpResponseDecorator(ServerHttpResponse delegate)
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 void
addCookie(ResponseCookie cookie)
Add the givenResponseCookie
.void
beforeCommit(Supplier<? extends reactor.core.publisher.Mono<Void>> action)
Register an action to apply just before the HttpOutputMessage is committed.DataBufferFactory
bufferFactory()
Return aDataBufferFactory
that can be used to create the body.MultiValueMap<String,ResponseCookie>
getCookies()
Return a mutable map with the cookies to send to the server.ServerHttpResponse
getDelegate()
HttpHeaders
getHeaders()
Return the headers of this message.HttpStatus
getStatusCode()
Return the status code that has been set, or otherwise fall back on the status of the response from the underlying server.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 viaHttpMessage.getHeaders()
to the underlying HTTP message (if not applied already).boolean
setStatusCode(HttpStatus status)
Set the HTTP status code of the response.String
toString()
reactor.core.publisher.Mono<Void>
writeAndFlushWith(org.reactivestreams.Publisher<? extends org.reactivestreams.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(org.reactivestreams.Publisher<? extends DataBuffer> body)
Use the givenPublisher
to write the body of the message to the underlying HTTP layer.从类继承的方法 java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
从接口继承的方法 org.springframework.http.server.reactive.ServerHttpResponse
getRawStatusCode, setRawStatusCode
构造器详细资料
ServerHttpResponseDecorator
public ServerHttpResponseDecorator(ServerHttpResponse delegate)
方法详细资料
getDelegate
public ServerHttpResponse getDelegate()
setStatusCode
public boolean setStatusCode(@Nullable HttpStatus status)
从接口复制的说明:ServerHttpResponse
Set the HTTP status code of the response.- 指定者:
setStatusCode
在接口中ServerHttpResponse
- 参数:
status
- the HTTP status as anHttpStatus
enum value- 返回:
false
if the status code change wasn't processed because the HTTP response is committed,true
if successfully set.
getStatusCode
public HttpStatus getStatusCode()
从接口复制的说明:ServerHttpResponse
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 benull
if the status code value is outside theHttpStatus
enum range, or if there is no default value from the underlying server.- 指定者:
getStatusCode
在接口中ServerHttpResponse
getHeaders
public HttpHeaders getHeaders()
从接口复制的说明:HttpMessage
Return the headers of this message.- 指定者:
getHeaders
在接口中HttpMessage
- 返回:
- a corresponding HttpHeaders object (never
null
)
getCookies
public MultiValueMap<String,ResponseCookie> getCookies()
从接口复制的说明:ServerHttpResponse
Return a mutable map with the cookies to send to the server.- 指定者:
getCookies
在接口中ServerHttpResponse
addCookie
public void addCookie(ResponseCookie cookie)
从接口复制的说明:ServerHttpResponse
Add the givenResponseCookie
.- 指定者:
addCookie
在接口中ServerHttpResponse
- 参数:
cookie
- the cookie to add
bufferFactory
public DataBufferFactory bufferFactory()
从接口复制的说明:ReactiveHttpOutputMessage
Return aDataBufferFactory
that can be used to create the body.- 指定者:
bufferFactory
在接口中ReactiveHttpOutputMessage
- 返回:
- a buffer factory
- 另请参阅:
ReactiveHttpOutputMessage.writeWith(Publisher)
beforeCommit
public void beforeCommit(Supplier<? extends reactor.core.publisher.Mono<Void>> action)
从接口复制的说明:ReactiveHttpOutputMessage
Register an action to apply just before the HttpOutputMessage is committed.Note: the supplied action must be properly deferred, e.g. 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.- 指定者:
beforeCommit
在接口中ReactiveHttpOutputMessage
- 参数:
action
- the action to apply
isCommitted
public boolean isCommitted()
从接口复制的说明:ReactiveHttpOutputMessage
Whether the HttpOutputMessage is committed.- 指定者:
isCommitted
在接口中ReactiveHttpOutputMessage
writeWith
public reactor.core.publisher.Mono<Void> writeWith(org.reactivestreams.Publisher<? extends DataBuffer> body)
从接口复制的说明:ReactiveHttpOutputMessage
Use the givenPublisher
to write the body of the message to the underlying HTTP layer.- 指定者:
writeWith
在接口中ReactiveHttpOutputMessage
- 参数:
body
- the body content publisher- 返回:
- a
Mono
that indicates completion or error
writeAndFlushWith
public reactor.core.publisher.Mono<Void> writeAndFlushWith(org.reactivestreams.Publisher<? extends org.reactivestreams.Publisher<? extends DataBuffer>> body)
从接口复制的说明:ReactiveHttpOutputMessage
Use the givenPublisher
ofPublishers
to write the body of the HttpOutputMessage to the underlying HTTP layer, flushing after eachPublisher<DataBuffer>
.- 指定者:
writeAndFlushWith
在接口中ReactiveHttpOutputMessage
- 参数:
body
- the body content publisher- 返回:
- a
Mono
that indicates completion or error
setComplete
public reactor.core.publisher.Mono<Void> setComplete()
从接口复制的说明:ReactiveHttpOutputMessage
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.
- 指定者:
setComplete
在接口中ReactiveHttpOutputMessage
- 返回:
- a
Mono
that indicates completion or error