接口 RenderingResponse.Builder
- 封闭接口:
- RenderingResponse
public static interface RenderingResponse.Builder
Defines a builder forRenderingResponse.
方法概要
所有方法 实例方法 抽象方法 修饰符和类型 方法 说明 reactor.core.publisher.Mono<RenderingResponse>build()Build the response.RenderingResponse.Buildercookie(ResponseCookie cookie)Add the given cookie to the response.RenderingResponse.Buildercookies(Consumer<MultiValueMap<String,ResponseCookie>> cookiesConsumer)Manipulate this response's cookies with the given consumer.RenderingResponse.Builderheader(String headerName, String... headerValues)Add the given header value(s) under the given name.RenderingResponse.Builderheaders(HttpHeaders headers)Copy the given headers into the entity's headers map.RenderingResponse.BuildermodelAttribute(Object attribute)Add the supplied attribute to the model using a generated name.RenderingResponse.BuildermodelAttribute(String name, Object value)Add the supplied attribute value under the supplied name.RenderingResponse.BuildermodelAttributes(Object... attributes)Copy all attributes in the supplied array into the model, using attribute name generation for each element.RenderingResponse.BuildermodelAttributes(Collection<?> attributes)Copy all attributes in the suppliedCollectioninto the model, using attribute name generation for each element.RenderingResponse.BuildermodelAttributes(Map<String,?> attributes)Copy all attributes in the suppliedMapinto the model.RenderingResponse.Builderstatus(int status)Set the HTTP status.RenderingResponse.Builderstatus(HttpStatus status)Set the HTTP status.
方法详细资料
modelAttribute
RenderingResponse.Builder modelAttribute(Object attribute)
Add the supplied attribute to the model using a generated name.Note: Empty
Collectionsare not added to the model when using this method because we cannot correctly determine the true convention name. View code should check fornullrather than for empty collections.- 参数:
attribute- the model attribute value (nevernull)
modelAttribute
RenderingResponse.Builder modelAttribute(String name, @Nullable Object value)
Add the supplied attribute value under the supplied name.- 参数:
name- the name of the model attribute (nevernull)value- the model attribute value (can benull)
modelAttributes
RenderingResponse.Builder modelAttributes(Object... attributes)
Copy all attributes in the supplied array into the model, using attribute name generation for each element.
modelAttributes
RenderingResponse.Builder modelAttributes(Collection<?> attributes)
Copy all attributes in the suppliedCollectioninto the model, using attribute name generation for each element.
modelAttributes
RenderingResponse.Builder modelAttributes(Map<String,?> attributes)
Copy all attributes in the suppliedMapinto the model.
header
RenderingResponse.Builder header(String headerName, String... headerValues)
Add the given header value(s) under the given name.- 参数:
headerName- the header nameheaderValues- the header value(s)- 返回:
- this builder
- 另请参阅:
HttpHeaders.add(String, String)
headers
RenderingResponse.Builder headers(HttpHeaders headers)
Copy the given headers into the entity's headers map.- 参数:
headers- the existing HttpHeaders to copy from- 返回:
- this builder
- 另请参阅:
HttpHeaders.add(String, String)
status
RenderingResponse.Builder status(HttpStatus status)
Set the HTTP status.- 参数:
status- the response status- 返回:
- this builder
status
RenderingResponse.Builder status(int status)
Set the HTTP status.- 参数:
status- the response status- 返回:
- this builder
- 从以下版本开始:
- 5.0.3
cookie
RenderingResponse.Builder cookie(ResponseCookie cookie)
Add the given cookie to the response.- 参数:
cookie- the cookie to add- 返回:
- this builder
cookies
RenderingResponse.Builder cookies(Consumer<MultiValueMap<String,ResponseCookie>> cookiesConsumer)
Manipulate this response's cookies with the given consumer. The cookies provided to the consumer are "live", so that the consumer can be used to overwrite existing cookies, remove cookies, or use any of the otherMultiValueMapmethods.- 参数:
cookiesConsumer- a function that consumes the cookies- 返回:
- this builder
build
reactor.core.publisher.Mono<RenderingResponse> build()
Build the response.- 返回:
- the built response