接口 ServerRequest.Builder
- 封闭接口:
- ServerRequest
public static interface ServerRequest.Builder
Defines a builder for a request.
方法概要
所有方法 实例方法 抽象方法 修饰符和类型 方法 说明 ServerRequest.Builder
attribute(String name, Object value)
Add an attribute with the given name and value.ServerRequest.Builder
attributes(Consumer<Map<String,Object>> attributesConsumer)
Manipulate this request's attributes with the given consumer.ServerRequest.Builder
body(byte[] body)
Set the body of the request.ServerRequest.Builder
body(String body)
Set the body of the request to the UTF-8 encoded bytes of the given string.ServerRequest
build()
Build the request.ServerRequest.Builder
cookie(String name, String... values)
Add a cookie with the given name and value(s).ServerRequest.Builder
cookies(Consumer<MultiValueMap<String,Cookie>> cookiesConsumer)
Manipulate this request's cookies with the given consumer.ServerRequest.Builder
header(String headerName, String... headerValues)
Add the given header value(s) under the given name.ServerRequest.Builder
headers(Consumer<HttpHeaders> headersConsumer)
Manipulate this request's headers with the given consumer.ServerRequest.Builder
method(HttpMethod method)
Set the method of the request.ServerRequest.Builder
uri(URI uri)
Set the URI of the request.
方法详细资料
method
ServerRequest.Builder method(HttpMethod method)
Set the method of the request.- 参数:
method
- the new method- 返回:
- this builder
uri
ServerRequest.Builder uri(URI uri)
Set the URI of the request.- 参数:
uri
- the new URI- 返回:
- this builder
header
ServerRequest.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
ServerRequest.Builder headers(Consumer<HttpHeaders> headersConsumer)
Manipulate this request'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 other
HttpHeaders
methods.- 参数:
headersConsumer
- a function that consumes theHttpHeaders
- 返回:
- this builder
cookie
ServerRequest.Builder cookie(String name, String... values)
Add a cookie with the given name and value(s).- 参数:
name
- the cookie namevalues
- the cookie value(s)- 返回:
- this builder
cookies
ServerRequest.Builder cookies(Consumer<MultiValueMap<String,Cookie>> cookiesConsumer)
Manipulate this request's cookies with the given consumer.The map provided to the consumer is "live", so that the consumer can be used to overwrite existing cookies, remove cookies, or use any of the other
MultiValueMap
methods.- 参数:
cookiesConsumer
- a function that consumes the cookies map- 返回:
- this builder
body
ServerRequest.Builder body(byte[] body)
Set the body of the request.Calling this methods will release the existing body of the builder.
- 参数:
body
- the new body- 返回:
- this builder
body
ServerRequest.Builder body(String body)
Set the body of the request to the UTF-8 encoded bytes of the given string.Calling this methods will release the existing body of the builder.
- 参数:
body
- the new body- 返回:
- this builder
attribute
ServerRequest.Builder attribute(String name, Object value)
Add an attribute with the given name and value.- 参数:
name
- the attribute namevalue
- the attribute value- 返回:
- this builder
attributes
ServerRequest.Builder attributes(Consumer<Map<String,Object>> attributesConsumer)
Manipulate this request's attributes with the given consumer.The map provided to the consumer is "live", so that the consumer can be used to overwrite existing attributes, remove attributes, or use any of the other
Map
methods.- 参数:
attributesConsumer
- a function that consumes the attributes map- 返回:
- this builder
build
ServerRequest build()
Build the request.- 返回:
- the built request