public static interface ServerRequest.Builder
Modifier and Type | Method and Description |
---|---|
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.
|
ServerRequest.Builder method(HttpMethod method)
method
- the new methodServerRequest.Builder uri(URI uri)
uri
- the new URIServerRequest.Builder header(String headerName, String... headerValues)
headerName
- the header nameheaderValues
- the header value(s)HttpHeaders.add(String, String)
ServerRequest.Builder headers(Consumer<HttpHeaders> headersConsumer)
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 the HttpHeaders
ServerRequest.Builder cookie(String name, String... values)
name
- the cookie namevalues
- the cookie value(s)ServerRequest.Builder cookies(Consumer<MultiValueMap<String,Cookie>> cookiesConsumer)
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 mapServerRequest.Builder body(byte[] body)
Calling this methods will release the existing body of the builder.
body
- the new bodyServerRequest.Builder body(String body)
Calling this methods will release the existing body of the builder.
body
- the new bodyServerRequest.Builder attribute(String name, Object value)
name
- the attribute namevalue
- the attribute valueServerRequest.Builder attributes(Consumer<Map<String,Object>> attributesConsumer)
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 mapServerRequest build()