接口 ServerHttpResponse
- 所有超级接口:
HttpMessage
,ReactiveHttpOutputMessage
- 所有已知实现类:
AbstractListenerServerHttpResponse
,AbstractServerHttpResponse
,HttpHeadResponseDecorator
,MockServerHttpResponse
,ServerHttpResponseDecorator
public interface ServerHttpResponse extends ReactiveHttpOutputMessage
Represents a reactive server-side HTTP response.- 从以下版本开始:
- 5.0
- 作者:
- Arjen Poutsma, Sebastien Deleuze, Rossen Stoyanchev
方法概要
所有方法 实例方法 抽象方法 默认方法 修饰符和类型 方法 说明 void
addCookie(ResponseCookie cookie)
Add the givenResponseCookie
.MultiValueMap<String,ResponseCookie>
getCookies()
Return a mutable map with the cookies to send to the server.default 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.default boolean
setRawStatusCode(Integer value)
Set the HTTP status code to the given value (potentially non-standard and not resolvable through theHttpStatus
enum) as an integer.boolean
setStatusCode(HttpStatus status)
Set the HTTP status code of the response.从接口继承的方法 org.springframework.http.HttpMessage
getHeaders
从接口继承的方法 org.springframework.http.ReactiveHttpOutputMessage
beforeCommit, bufferFactory, isCommitted, setComplete, writeAndFlushWith, writeWith
方法详细资料
setStatusCode
boolean setStatusCode(@Nullable HttpStatus status)
Set the HTTP status code of the response.- 参数:
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
@Nullable HttpStatus 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 benull
if the status code value is outside theHttpStatus
enum range, or if there is no default value from the underlying server.
setRawStatusCode
default boolean setRawStatusCode(@Nullable Integer value)
Set the HTTP status code to the given value (potentially non-standard and not resolvable through theHttpStatus
enum) as an integer.- 参数:
value
- the status code value- 返回:
false
if the status code change wasn't processed because the HTTP response is committed,true
if successfully set.- 从以下版本开始:
- 5.2.4
getRawStatusCode
@Nullable default Integer getRawStatusCode()
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 there is no default value from the underlying server.- 从以下版本开始:
- 5.2.4
getCookies
MultiValueMap<String,ResponseCookie> getCookies()
Return a mutable map with the cookies to send to the server.
addCookie
void addCookie(ResponseCookie cookie)
Add the givenResponseCookie
.- 参数:
cookie
- the cookie to add- 抛出:
IllegalStateException
- if the response has already been committed