Class WebExchangeDataBinder
- java.lang.Object
- org.springframework.validation.DataBinder
- org.springframework.web.bind.WebDataBinder
- org.springframework.web.bind.support.WebExchangeDataBinder
- All Implemented Interfaces:
PropertyEditorRegistry
,TypeConverter
public class WebExchangeDataBinder extends WebDataBinder
SpecializedDataBinder
to perform data binding from URL query params or form data in the request data to Java objects.- Since:
- 5.0
- Author:
- Rossen Stoyanchev
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
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description reactor.core.publisher.Mono<Void>
bind(ServerWebExchange exchange)
Bind query params, form data, and or multipart form data to the binder target.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 aMap<String, Object>
of values to use for data binding purposes.protected reactor.core.publisher.Mono<Map<String,Object>>
getValuesToBind(ServerWebExchange exchange)
Protected method to obtain the values for data binding.Methods inherited from class org.springframework.web.bind.WebDataBinder
bindMultipart, checkFieldDefaults, checkFieldMarkers, doBind, getEmptyValue, getEmptyValue, getFieldDefaultPrefix, getFieldMarkerPrefix, isBindEmptyMultipartFiles, setBindEmptyMultipartFiles, setFieldDefaultPrefix, setFieldMarkerPrefix
Methods inherited from class org.springframework.validation.DataBinder
addCustomFormatter, addCustomFormatter, addCustomFormatter, addValidators, applyPropertyValues, bind, checkAllowedFields, checkRequiredFields, close, convertIfNecessary, convertIfNecessary, convertIfNecessary, convertIfNecessary, createBeanPropertyBindingResult, createDirectFieldBindingResult, findCustomEditor, getAllowedFields, getAutoGrowCollectionLimit, getBindingErrorProcessor, getBindingResult, getConversionService, getDisallowedFields, getInternalBindingResult, getObjectName, getPropertyAccessor, getPropertyEditorRegistry, getRequiredFields, getSimpleTypeConverter, getTarget, getTypeConverter, getValidator, getValidators, initBeanPropertyAccess, initDirectFieldAccess, isAllowed, isAutoGrowNestedPaths, isIgnoreInvalidFields, isIgnoreUnknownFields, registerCustomEditor, registerCustomEditor, replaceValidators, setAllowedFields, setAutoGrowCollectionLimit, setAutoGrowNestedPaths, setBindingErrorProcessor, setConversionService, setDisallowedFields, setIgnoreInvalidFields, setIgnoreUnknownFields, setMessageCodesResolver, setRequiredFields, setValidator, validate, validate
Constructor Detail
WebExchangeDataBinder
public WebExchangeDataBinder(@Nullable Object target)
Create a new instance, with default object name.- Parameters:
target
- the target object to bind onto (ornull
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 (ornull
if the binder is just used to convert a plain parameter value)objectName
- the name of the target object
Method Detail
bind
public reactor.core.publisher.Mono<Void> bind(ServerWebExchange exchange)
Bind query params, form data, and or multipart form data to the binder target.- Parameters:
exchange
- the current exchange- Returns:
- a
Mono<Void>
when binding is complete
getValuesToBind
protected reactor.core.publisher.Mono<Map<String,Object>> getValuesToBind(ServerWebExchange exchange)
Protected method to obtain the values for data binding. By default this method delegates toextractValuesToBind(ServerWebExchange)
.
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 aMap<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()