接口 ServerResponse.BodyBuilder
- 所有已知实现类:
DefaultServerResponseBuilder
- 封闭接口:
- ServerResponse
public static interface ServerResponse.BodyBuilder
extends ServerResponse.HeadersBuilder<ServerResponse.BodyBuilder>
Defines a builder that adds a body to the response.
-
嵌套类概要
从接口继承的嵌套类/接口 cn.taketoday.web.handler.function.ServerResponse.HeadersBuilder
ServerResponse.HeadersBuilder.WriteFunction -
方法概要
修饰符和类型方法说明Set the body of the response to the givenObjectand return it.<T> ServerResponsebody(T body, cn.taketoday.core.ParameterizedTypeReference<T> bodyType) Set the body of the response to the givenObjectand return it.contentLength(long contentLength) Set the length of the body in bytes, as specified by theContent-Lengthheader.contentType(MediaType contentType) Set the media type of the body, as specified by theContent-Typeheader.render(ModelAndView modelAndView) Render the template with the givenModelAndView.Render the template with the givennameusing the givenmodelAttributes.Render the template with the givennameusing the givenmodel.从接口继承的方法 cn.taketoday.web.handler.function.ServerResponse.HeadersBuilder
allow, allow, build, build, cacheControl, cookie, cookies, eTag, header, headers, lastModified, lastModified, location, varyBy
-
方法详细资料
-
contentLength
Set the length of the body in bytes, as specified by theContent-Lengthheader.- 参数:
contentLength- the content length- 返回:
- this builder
- 另请参阅:
-
contentType
Set the media type of the body, as specified by theContent-Typeheader.- 参数:
contentType- the content type- 返回:
- this builder
- 另请参阅:
-
body
Set the body of the response to the givenObjectand return it.Asynchronous response bodies are supported by providing a
CompletionStageorPublisheras body (or any asynchronous producer of a single entity that can be adapted via theReactiveAdapterRegistry).- 参数:
body- the body of the response- 返回:
- the built response
-
body
Set the body of the response to the givenObjectand return it. The parameterbodyTypeis used to capture the generic type.- 参数:
body- the body of the responsebodyType- the type of the body, used to capture the generic type- 返回:
- the built response
-
render
Render the template with the givennameusing the givenmodelAttributes. The model attributes are mapped under a generated name.Note: Empty
Collectionsare not added to the model when using this method because we cannot correctly determine the true convention name.- 参数:
name- the name of the template to be renderedmodelAttributes- the modelAttributes used to render the template- 返回:
- the built response
-
render
Render the template with the givennameusing the givenmodel.- 参数:
name- the name of the template to be renderedmodel- the model used to render the template- 返回:
- the built response
-
render
Render the template with the givenModelAndView.- 参数:
modelAndView- the model and view used to render the template- 返回:
- the built response
-