Package org.springframework.web.bind.support

# Class WebExchangeDataBinder

java.lang.Object
org.springframework.validation.DataBinder
org.springframework.web.bind.WebDataBinder
org.springframework.web.bind.support.WebExchangeDataBinder

All Implemented Interfaces:
  `org.springframework.beans.PropertyEditorRegistry`, `org.springframework.beans.TypeConverter`

public class WebExchangeDataBinder extends WebDataBinder
Specialized `DataBinder` to perform data binding from URL query parameters or form data in the request data to Java objects.

WARNING: Data binding can lead to security issues by exposing parts of the object graph that are not meant to be accessed or modified by external clients. Therefore the design and use of data binding should be considered carefully with regard to security. For more details, please refer to the dedicated sections on data binding for Spring Web MVC and Spring WebFlux in the reference manual.

Since:
  5.0
Author:
  Rossen Stoyanchev, Juergen Hoeller

## Nested Class Summary

## Nested classes/interfaces inherited from class org.springframework.validation.DataBinder

`org.springframework.validation.DataBinder.NameResolver, org.springframework.validation.DataBinder.ValueResolver`

## Field Summary

### Fields inherited from class org.springframework.web.bind.WebDataBinder

`DEFAULT_FIELD_DEFAULT_PREFIX, DEFAULT_FIELD_MARKER_PREFIX`

### Fields inherited from class org.springframework.validation.DataBinder

`DEFAULT_AUTO_GROW_COLLECTION_LIMIT, DEFAULT_OBJECT_NAME, logger`

## Constructor Summary

Constructors
Constructor
Description
`WebExchangeDataBinder(Object target)`
Create a new instance, with default object name.
`WebExchangeDataBinder(Object target, String objectName)`
Create a new instance.

## Method Summary

Modifier and Type
Method
Description
`protected static void`
`addBindValue(Map<String,Object> params, String key, List<?> values)`
`reactor.core.publisher.Mono<Void>`
`bind(ServerWebExchange exchange)`
Bind query parameters, form data, or multipart form data to the binder target.
`reactor.core.publisher.Mono<Void>`
`construct(ServerWebExchange exchange)`
Use a default or single data constructor to create the target by binding request parameters, multipart files, or parts to constructor args.
`static reactor.core.publisher.Mono<Map<String,Object>>`
`extractValuesToBind(ServerWebExchange exchange)`
Combine query params and form data for multipart form data from the body of the request into a `Map<String, Object>` of values to use for data binding purposes.
`reactor.core.publisher.Mono<Map<String,Object>>`
`getValuesToBind(ServerWebExchange exchange)`
Obtain the values for data binding.
`protected boolean`
`shouldConstructArgument(org.springframework.core.MethodParameter param)`

### Methods inherited from class org.springframework.web.bind.WebDataBinder

`adaptEmptyArrayIndices, bindMultipart, checkFieldDefaults, checkFieldMarkers, doBind, getEmptyValue, getEmptyValue, getFieldDefaultPrefix, getFieldMarkerPrefix, isBindEmptyMultipartFiles, resolvePrefixValue, setBindEmptyMultipartFiles, setFieldDefaultPrefix, setFieldMarkerPrefix`

### Methods inherited from class org.springframework.validation.DataBinder

`addCustomFormatter, addCustomFormatter, addCustomFormatter, addValidators, applyPropertyValues, bind, checkAllowedFields, checkRequiredFields, close, construct, convertIfNecessary, convertIfNecessary, convertIfNecessary, convertIfNecessary, createBeanPropertyBindingResult, createDirectFieldBindingResult, findCustomEditor, getAllowedFields, getAutoGrowCollectionLimit, getBindingErrorProcessor, getBindingResult, getConversionService, getDisallowedFields, getInternalBindingResult, getNameResolver, getObjectName, getPropertyAccessor, getPropertyEditorRegistry, getRequiredFields, getSimpleTypeConverter, getTarget, getTargetType, getTypeConverter, getValidator, getValidators, getValidatorsToApply, initBeanPropertyAccess, initDirectFieldAccess, isAllowed, isAutoGrowNestedPaths, isDeclarativeBinding, isIgnoreInvalidFields, isIgnoreUnknownFields, registerCustomEditor, registerCustomEditor, replaceValidators, setAllowedFields, setAutoGrowCollectionLimit, setAutoGrowNestedPaths, setBindingErrorProcessor, setConversionService, setDeclarativeBinding, setDisallowedFields, setExcludedValidators, setIgnoreInvalidFields, setIgnoreUnknownFields, setMessageCodesResolver, setNameResolver, setRequiredFields, setTargetType, setValidator, shouldNotBindPropertyValues, validate, validate`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Constructor Details

### WebExchangeDataBinder

public WebExchangeDataBinder(@Nullable Object target)
Create a new instance, with default object name.

Parameters:
  `target` - the target object to bind onto (or `null` if the binder is just used to convert a plain parameter value)
See Also:
  - `DataBinder.DEFAULT_OBJECT_NAME`

### WebExchangeDataBinder

public WebExchangeDataBinder(@Nullable Object target, String objectName)
Create a new instance.

Parameters:
  `target` - the target object to bind onto (or `null` if the binder is just used to convert a plain parameter value)
  `objectName` - the name of the target object

## Method Details

### construct

public reactor.core.publisher.Mono<Void> construct(ServerWebExchange exchange)
Use a default or single data constructor to create the target by binding request parameters, multipart files, or parts to constructor args.

After the call, use `DataBinder.getBindingResult()` to check for bind errors. If there are none, the target is set, and `bind(org.springframework.web.server.ServerWebExchange)` can be called for further initialization via setters.

Parameters:
  `exchange` - the request to bind
Returns:
  a `Mono<Void>` that completes when the target is created
Since:
  6.1

### shouldConstructArgument

protected boolean shouldConstructArgument(org.springframework.core.MethodParameter param)

Overrides:
  `shouldConstructArgument` in class `org.springframework.validation.DataBinder`

### bind

public reactor.core.publisher.Mono<Void> bind(ServerWebExchange exchange)
Bind query parameters, form data, or multipart form data to the binder target.

Parameters:
  `exchange` - the current exchange
Returns:
  a `Mono<Void>` that completes when binding is complete

### getValuesToBind

public reactor.core.publisher.Mono<Map<String,Object>> getValuesToBind(ServerWebExchange exchange)
Obtain the values for data binding. By default, this delegates to `extractValuesToBind(ServerWebExchange)`.

Parameters:
  `exchange` - the current exchange
Returns:
  a map of bind values
Since:
  5.3

### extractValuesToBind

public static reactor.core.publisher.Mono<Map<String,Object>> extractValuesToBind(ServerWebExchange exchange)
Combine query params and form data for multipart form data from the body of the request into a `Map<String, Object>` of values to use for data binding purposes.

Parameters:
  `exchange` - the current exchange
Returns:
  a `Mono` with the values to bind
See Also:
  - `ServerHttpRequest.getQueryParams()`
  - `ServerWebExchange.getFormData()`
  - `ServerWebExchange.getMultipartData()`

### addBindValue

protected static void addBindValue(Map<String,Object> params, String key, List<?> values)