接口 RenderingResponse.Builder
- 所有已知实现类:
DefaultRenderingResponseBuilder
- 封闭接口:
- RenderingResponse
public static interface RenderingResponse.Builder
Defines a builder for
RenderingResponse.-
方法概要
修饰符和类型方法说明build()Build the response.cookie(HttpCookie cookie) Add the given cookie to the response.cookies(Consumer<cn.taketoday.util.MultiValueMap<String, HttpCookie>> cookiesConsumer) Manipulate this response's cookies with the given consumer.Add the given header value(s) under the given name.headers(Consumer<HttpHeaders> headersConsumer) Manipulate this response's headers with the given consumer.modelAttribute(Object attribute) Add the supplied attribute to the model using a generated name.modelAttribute(String name, Object value) Add the supplied attribute value under the supplied name.modelAttributes(Object... attributes) Copy all attributes in the supplied array into the model, using attribute name generation for each element.modelAttributes(Collection<?> attributes) Copy all attributes in the suppliedCollectioninto the model, using attribute name generation for each element.modelAttributes(Map<String, ?> attributes) Copy all attributes in the suppliedMapinto the model.status(int status) Set the HTTP status.status(HttpStatusCode status) Set the HTTP status.
-
方法详细资料
-
modelAttribute
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
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
Copy all attributes in the supplied array into the model, using attribute name generation for each element.- 另请参阅:
-
modelAttributes
Copy all attributes in the suppliedCollectioninto the model, using attribute name generation for each element.- 另请参阅:
-
modelAttributes
Copy all attributes in the suppliedMapinto the model. -
header
Add the given header value(s) under the given name.- 参数:
headerName- the header nameheaderValues- the header value(s)- 返回:
- this builder
- 另请参阅:
-
headers
Manipulate this response's headers with the given consumer. The headers provided to the consumer are "live", so that the consumer can be used to overwrite existing header values, remove values, or use any of the otherHttpHeadersmethods.- 参数:
headersConsumer- a function that consumes theHttpHeaders- 返回:
- this builder
-
status
Set the HTTP status.- 参数:
status- the response status- 返回:
- this builder
-
status
Set the HTTP status.- 参数:
status- the response status- 返回:
- this builder
-
cookie
Add the given cookie to the response.- 参数:
cookie- the cookie to add- 返回:
- this builder
-
cookies
RenderingResponse.Builder cookies(Consumer<cn.taketoday.util.MultiValueMap<String, HttpCookie>> 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
RenderingResponse build()Build the response.- 返回:
- the built response
-