Package org.springframework.web.servlet.function

# Interface ServerRequest.Builder

Enclosing interface:
  ServerRequest

public static interface ServerRequest.Builder
Defines a builder for a request.

## Method Summary

Modifier and Type
Method
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<org.springframework.util.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<org.springframework.http.HttpHeaders> headersConsumer)`
Manipulate this request's headers with the given consumer.
`ServerRequest.Builder`
`method(org.springframework.http.HttpMethod method)`
Set the method of the request.
`ServerRequest.Builder`
`param(String name, String... values)`
Add a parameter with the given name and value.
`ServerRequest.Builder`
`params(Consumer<org.springframework.util.MultiValueMap<String,String>> paramsConsumer)`
Manipulate this request's parameters with the given consumer.
`ServerRequest.Builder`
`remoteAddress(InetSocketAddress remoteAddress)`
Set the remote address of the request.
`ServerRequest.Builder`
`uri(URI uri)`
Set the URI of the request.

## Method Details

### method

ServerRequest.Builder method(org.springframework.http.HttpMethod method)
Set the method of the request.

Parameters:
  `method` - the new method
Returns:
  this builder

### uri

ServerRequest.Builder uri(URI uri)
Set the URI of the request.

Parameters:
  `uri` - the new URI
Returns:
  this builder

### header

ServerRequest.Builder header(String headerName, String... headerValues)
Add the given header value(s) under the given name.

Parameters:
  `headerName` - the header name
  `headerValues` - the header value(s)
Returns:
  this builder
See Also:
  - `HttpHeaders.add(String, String)`

### headers

ServerRequest.Builder headers(Consumer<org.springframework.http.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.

Parameters:
  `headersConsumer` - a function that consumes the `HttpHeaders`
Returns:
  this builder

### cookie

ServerRequest.Builder cookie(String name, String... values)
Add a cookie with the given name and value(s).

Parameters:
  `name` - the cookie name
  `values` - the cookie value(s)
Returns:
  this builder

### cookies

ServerRequest.Builder cookies(Consumer<org.springframework.util.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.

Parameters:
  `cookiesConsumer` - a function that consumes the cookies map
Returns:
  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.

Parameters:
  `body` - the new body
Returns:
  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.

Parameters:
  `body` - the new body
Returns:
  this builder

### attribute

ServerRequest.Builder attribute(String name, Object value)
Add an attribute with the given name and value.

Parameters:
  `name` - the attribute name
  `value` - the attribute value
Returns:
  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.

Parameters:
  `attributesConsumer` - a function that consumes the attributes map
Returns:
  this builder

### param

ServerRequest.Builder param(String name, String... values)
Add a parameter with the given name and value.

Parameters:
  `name` - the parameter name
  `values` - the parameter value(s)
Returns:
  this builder

### params

ServerRequest.Builder params(Consumer<org.springframework.util.MultiValueMap<String,String>> paramsConsumer)
Manipulate this request's parameters 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.

Parameters:
  `paramsConsumer` - a function that consumes the parameters map
Returns:
  this builder

### remoteAddress

ServerRequest.Builder remoteAddress(InetSocketAddress remoteAddress)
Set the remote address of the request.

Parameters:
  `remoteAddress` - the remote address
Returns:
  this builder

### build

ServerRequest build()
Build the request.

Returns:
  the built request