public class RequestBodyArgumentResolver extends AbstractMessageReaderArgumentResolver implements HandlerMethodArgumentResolver
@RequestBody by reading the
body of the request through a compatible HttpMessageReader.
An @RequestBody method argument is also validated if it is
annotated with @javax.validation.Valid or
Validated. Validation
failure results in an ServerWebInputException.
| Constructor and Description |
|---|
RequestBodyArgumentResolver(List<HttpMessageReader<?>> readers,
Validator validator)
Constructor with
HttpMessageReader's and a Validator. |
RequestBodyArgumentResolver(List<HttpMessageReader<?>> readers,
Validator validator,
ReactiveAdapterRegistry adapterRegistry)
Constructor that also accepts a
ReactiveAdapterRegistry. |
| Modifier and Type | Method and Description |
|---|---|
reactor.core.publisher.Mono<Object> |
resolveArgument(MethodParameter param,
ModelMap model,
ServerWebExchange exchange)
The returned
Mono may produce one or zero values if the argument
does not resolve to any value, which will result in null passed
as the argument value. |
boolean |
supportsParameter(MethodParameter parameter) |
applyValidationIfApplicable, checkRequired, getAdapterRegistry, getMessageReaders, getReadError, getRequiredBodyError, readBodypublic RequestBodyArgumentResolver(List<HttpMessageReader<?>> readers, Validator validator)
HttpMessageReader's and a Validator.readers - readers for de-serializing the request body withvalidator - validator to validate decoded objects withpublic RequestBodyArgumentResolver(List<HttpMessageReader<?>> readers, Validator validator, ReactiveAdapterRegistry adapterRegistry)
ReactiveAdapterRegistry.readers - readers for de-serializing the request body withvalidator - validator to validate decoded objects withadapterRegistry - for adapting to other reactive types from Flux and Monopublic boolean supportsParameter(MethodParameter parameter)
supportsParameter in interface HandlerMethodArgumentResolverpublic reactor.core.publisher.Mono<Object> resolveArgument(MethodParameter param, ModelMap model, ServerWebExchange exchange)
HandlerMethodArgumentResolverMono may produce one or zero values if the argument
does not resolve to any value, which will result in null passed
as the argument value.resolveArgument in interface HandlerMethodArgumentResolverparam - the method parametermodel - the implicit model for request handlingexchange - the current exchange