接口 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
方法概要
所有方法 实例方法 抽象方法 默认方法 修饰符和类型 方法 说明 voidaddCookie(ResponseCookie cookie)Add the givenResponseCookie.MultiValueMap<String,ResponseCookie>getCookies()Return a mutable map with the cookies to send to the server.default IntegergetRawStatusCode()Return the status code that has been set, or otherwise fall back on the status of the response from the underlying server.HttpStatusgetStatusCode()Return the status code that has been set, or otherwise fall back on the status of the response from the underlying server.default booleansetRawStatusCode(Integer value)Set the HTTP status code to the given value (potentially non-standard and not resolvable through theHttpStatusenum) as an integer.booleansetStatusCode(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 anHttpStatusenum value- 返回:
falseif the status code change wasn't processed because the HTTP response is committed,trueif 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 benullif the status code value is outside theHttpStatusenum 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 theHttpStatusenum) as an integer.- 参数:
value- the status code value- 返回:
falseif the status code change wasn't processed because the HTTP response is committed,trueif 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 benullif 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