类 DefaultServerResponseBuilder
java.lang.Object
cn.taketoday.web.handler.function.DefaultServerResponseBuilder
Default
ServerResponse.BodyBuilder implementation.- 从以下版本开始:
- 4.0
- 作者:
- Arjen Poutsma, Harry Yang
-
嵌套类概要
嵌套类从接口继承的嵌套类/接口 cn.taketoday.web.handler.function.ServerResponse.HeadersBuilder
ServerResponse.HeadersBuilder.WriteFunction -
字段概要
字段修饰符和类型字段说明private final cn.taketoday.util.MultiValueMap<String,HttpCookie> private final HttpHeadersprivate final HttpStatusCode -
构造器概要
构造器构造器说明 -
方法概要
修饰符和类型方法说明allow(HttpMethod... allowedMethods) Set the set of allowedHTTP methods, as specified by theAllowheader.allow(Set<HttpMethod> allowedMethods) Set the set of allowedHTTP methods, as specified by theAllowheader.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.build()Build the response entity with no body.build(ServerResponse.HeadersBuilder.WriteFunction writeFunction) Build the response entity with a custom write function.cacheControl(CacheControl cacheControl) Set the caching directives for the resource, as specified by the HTTP 1.1Cache-Controlheader.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.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.Set the entity tag of the body, as specified by theETagheader.Add the given header value(s) under the given name.headers(Consumer<HttpHeaders> headersConsumer) Manipulate this response's headers with the given consumer.lastModified(Instant lastModified) Set the time the resource was last changed, as specified by theLast-Modifiedheader.lastModified(ZonedDateTime lastModified) Set the time the resource was last changed, as specified by theLast-Modifiedheader.Set the location of a resource, as specified by theLocationheader.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.Configure one or more request header names (e.g.
-
字段详细资料
-
statusCode
-
headers
-
cookies
-
-
构造器详细资料
-
DefaultServerResponseBuilder
-
DefaultServerResponseBuilder
-
-
方法详细资料
-
header
从接口复制的说明:ServerResponse.HeadersBuilderAdd the given header value(s) under the given name.- 指定者:
header在接口中ServerResponse.HeadersBuilder<ServerResponse.BodyBuilder>- 参数:
headerName- the header nameheaderValues- the header value(s)- 返回:
- this builder
- 另请参阅:
-
headers
从接口复制的说明:ServerResponse.HeadersBuilderManipulate 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.- 指定者:
headers在接口中ServerResponse.HeadersBuilder<ServerResponse.BodyBuilder>- 参数:
headersConsumer- a function that consumes theHttpHeaders- 返回:
- this builder
-
cookie
从接口复制的说明:ServerResponse.HeadersBuilderAdd the given cookie to the response.- 指定者:
cookie在接口中ServerResponse.HeadersBuilder<ServerResponse.BodyBuilder>- 参数:
cookie- the cookie to add- 返回:
- this builder
-
cookies
public ServerResponse.BodyBuilder cookies(Consumer<cn.taketoday.util.MultiValueMap<String, HttpCookie>> cookiesConsumer) 从接口复制的说明:ServerResponse.HeadersBuilderManipulate 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.- 指定者:
cookies在接口中ServerResponse.HeadersBuilder<ServerResponse.BodyBuilder>- 参数:
cookiesConsumer- a function that consumes the cookies- 返回:
- this builder
-
allow
从接口复制的说明:ServerResponse.HeadersBuilderSet the set of allowedHTTP methods, as specified by theAllowheader.- 指定者:
allow在接口中ServerResponse.HeadersBuilder<ServerResponse.BodyBuilder>- 参数:
allowedMethods- the allowed methods- 返回:
- this builder
- 另请参阅:
-
allow
从接口复制的说明:ServerResponse.HeadersBuilderSet the set of allowedHTTP methods, as specified by theAllowheader.- 指定者:
allow在接口中ServerResponse.HeadersBuilder<ServerResponse.BodyBuilder>- 参数:
allowedMethods- the allowed methods- 返回:
- this builder
- 另请参阅:
-
contentLength
从接口复制的说明:ServerResponse.BodyBuilderSet the length of the body in bytes, as specified by theContent-Lengthheader.- 指定者:
contentLength在接口中ServerResponse.BodyBuilder- 参数:
contentLength- the content length- 返回:
- this builder
- 另请参阅:
-
contentType
从接口复制的说明:ServerResponse.BodyBuilderSet the media type of the body, as specified by theContent-Typeheader.- 指定者:
contentType在接口中ServerResponse.BodyBuilder- 参数:
contentType- the content type- 返回:
- this builder
- 另请参阅:
-
eTag
从接口复制的说明:ServerResponse.HeadersBuilderSet the entity tag of the body, as specified by theETagheader.- 指定者:
eTag在接口中ServerResponse.HeadersBuilder<ServerResponse.BodyBuilder>- 参数:
etag- the new entity tag- 返回:
- this builder
- 另请参阅:
-
lastModified
从接口复制的说明:ServerResponse.HeadersBuilderSet the time the resource was last changed, as specified by theLast-Modifiedheader.- 指定者:
lastModified在接口中ServerResponse.HeadersBuilder<ServerResponse.BodyBuilder>- 参数:
lastModified- the last modified date- 返回:
- this builder
- 另请参阅:
-
lastModified
从接口复制的说明:ServerResponse.HeadersBuilderSet the time the resource was last changed, as specified by theLast-Modifiedheader.- 指定者:
lastModified在接口中ServerResponse.HeadersBuilder<ServerResponse.BodyBuilder>- 参数:
lastModified- the last modified date- 返回:
- this builder
- 另请参阅:
-
location
从接口复制的说明:ServerResponse.HeadersBuilderSet the location of a resource, as specified by theLocationheader.- 指定者:
location在接口中ServerResponse.HeadersBuilder<ServerResponse.BodyBuilder>- 参数:
location- the location- 返回:
- this builder
- 另请参阅:
-
cacheControl
从接口复制的说明:ServerResponse.HeadersBuilderSet the caching directives for the resource, as specified by the HTTP 1.1Cache-Controlheader.A
CacheControlinstance can be built likeCacheControl.maxAge(3600).cachePublic().noTransform().- 指定者:
cacheControl在接口中ServerResponse.HeadersBuilder<ServerResponse.BodyBuilder>- 参数:
cacheControl- a builder for cache-related HTTP response headers- 返回:
- this builder
- 另请参阅:
-
varyBy
从接口复制的说明:ServerResponse.HeadersBuilderConfigure one or more request header names (e.g. "Accept-Language") to add to the "Vary" response header to inform clients that the response is subject to content negotiation and variances based on the value of the given request headers. The configured request header names are added only if not already present in the response "Vary" header.- 指定者:
varyBy在接口中ServerResponse.HeadersBuilder<ServerResponse.BodyBuilder>- 参数:
requestHeaders- request header names- 返回:
- this builder
-
build
从接口复制的说明:ServerResponse.HeadersBuilderBuild the response entity with no body. -
build
从接口复制的说明:ServerResponse.HeadersBuilderBuild the response entity with a custom write function.- 指定者:
build在接口中ServerResponse.HeadersBuilder<ServerResponse.BodyBuilder>- 参数:
writeFunction- the function used to write to theHttpServletResponse
-
body
从接口复制的说明:ServerResponse.BodyBuilderSet 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在接口中ServerResponse.BodyBuilder- 参数:
body- the body of the response- 返回:
- the built response
-
body
从接口复制的说明:ServerResponse.BodyBuilderSet the body of the response to the givenObjectand return it. The parameterbodyTypeis used to capture the generic type.- 指定者:
body在接口中ServerResponse.BodyBuilder- 参数:
body- the body of the responsebodyType- the type of the body, used to capture the generic type- 返回:
- the built response
-
render
从接口复制的说明:ServerResponse.BodyBuilderRender 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.- 指定者:
render在接口中ServerResponse.BodyBuilder- 参数:
name- the name of the template to be renderedmodelAttributes- the modelAttributes used to render the template- 返回:
- the built response
-
render
从接口复制的说明:ServerResponse.BodyBuilderRender the template with the givennameusing the givenmodel.- 指定者:
render在接口中ServerResponse.BodyBuilder- 参数:
name- the name of the template to be renderedmodel- the model used to render the template- 返回:
- the built response
-
render
从接口复制的说明:ServerResponse.BodyBuilderRender the template with the givenModelAndView.- 指定者:
render在接口中ServerResponse.BodyBuilder- 参数:
modelAndView- the model and view used to render the template- 返回:
- the built response
-