class DefaultServerRequestBuilder extends java.lang.Object implements ServerRequest.Builder
ServerRequest.Builder
implementation.Modifier and Type | Class and Description |
---|---|
private static class |
DefaultServerRequestBuilder.BuiltServerHttpRequest |
private static class |
DefaultServerRequestBuilder.DelegatingServerWebExchange |
Modifier and Type | Field and Description |
---|---|
private java.util.Map<java.lang.String,java.lang.Object> |
attributes |
private <any> |
body |
private MultiValueMap<java.lang.String,HttpCookie> |
cookies |
private ServerWebExchange |
exchange |
private HttpHeaders |
headers |
private java.util.List<HttpMessageReader<?>> |
messageReaders |
private java.lang.String |
methodName |
private java.net.URI |
uri |
Constructor and Description |
---|
DefaultServerRequestBuilder(ServerRequest other) |
Modifier and Type | Method and Description |
---|---|
ServerRequest.Builder |
attribute(java.lang.String name,
java.lang.Object value)
Add an attribute with the given name and value.
|
ServerRequest.Builder |
attributes(java.util.function.Consumer<java.util.Map<java.lang.String,java.lang.Object>> attributesConsumer)
Manipulate this request's attributes with the given consumer.
|
ServerRequest.Builder |
body(<any> body)
Set the body of the request.
|
ServerRequest |
build()
Build the request.
|
ServerRequest.Builder |
cookie(java.lang.String name,
java.lang.String... values)
Add a cookie with the given name and value(s).
|
ServerRequest.Builder |
cookies(java.util.function.Consumer<MultiValueMap<java.lang.String,HttpCookie>> cookiesConsumer)
Manipulate this request's cookies with the given consumer.
|
ServerRequest.Builder |
header(java.lang.String headerName,
java.lang.String... headerValues)
Add the given header value(s) under the given name.
|
ServerRequest.Builder |
headers(java.util.function.Consumer<HttpHeaders> headersConsumer)
Manipulate this request's headers with the given consumer.
|
ServerRequest.Builder |
method(HttpMethod method)
Set the method of the request.
|
private void |
releaseBody() |
ServerRequest.Builder |
uri(java.net.URI uri)
Set the URI of the request.
|
private final java.util.List<HttpMessageReader<?>> messageReaders
private ServerWebExchange exchange
private java.lang.String methodName
private java.net.URI uri
private final HttpHeaders headers
private final MultiValueMap<java.lang.String,HttpCookie> cookies
private final java.util.Map<java.lang.String,java.lang.Object> attributes
private <any> body
public DefaultServerRequestBuilder(ServerRequest other)
public ServerRequest.Builder method(HttpMethod method)
ServerRequest.Builder
method
in interface ServerRequest.Builder
method
- the new methodpublic ServerRequest.Builder uri(java.net.URI uri)
ServerRequest.Builder
uri
in interface ServerRequest.Builder
uri
- the new URIpublic ServerRequest.Builder header(java.lang.String headerName, java.lang.String... headerValues)
ServerRequest.Builder
header
in interface ServerRequest.Builder
headerName
- the header nameheaderValues
- the header value(s)HttpHeaders.add(String, String)
public ServerRequest.Builder headers(java.util.function.Consumer<HttpHeaders> headersConsumer)
ServerRequest.Builder
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.
headers
in interface ServerRequest.Builder
headersConsumer
- a function that consumes the HttpHeaders
public ServerRequest.Builder cookie(java.lang.String name, java.lang.String... values)
ServerRequest.Builder
cookie
in interface ServerRequest.Builder
name
- the cookie namevalues
- the cookie value(s)public ServerRequest.Builder cookies(java.util.function.Consumer<MultiValueMap<java.lang.String,HttpCookie>> cookiesConsumer)
ServerRequest.Builder
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.
cookies
in interface ServerRequest.Builder
cookiesConsumer
- a function that consumes the cookies mappublic ServerRequest.Builder body(<any> body)
ServerRequest.Builder
Calling this methods will release the existing body of the builder.
body
in interface ServerRequest.Builder
body
- the new bodyprivate void releaseBody()
public ServerRequest.Builder attribute(java.lang.String name, java.lang.Object value)
ServerRequest.Builder
attribute
in interface ServerRequest.Builder
name
- the attribute namevalue
- the attribute valuepublic ServerRequest.Builder attributes(java.util.function.Consumer<java.util.Map<java.lang.String,java.lang.Object>> attributesConsumer)
ServerRequest.Builder
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.
attributes
in interface ServerRequest.Builder
attributesConsumer
- a function that consumes the attributes mappublic ServerRequest build()
ServerRequest.Builder
build
in interface ServerRequest.Builder