Class AbstractMessageReaderArgumentResolver
java.lang.Object
org.springframework.web.reactive.result.method.HandlerMethodArgumentResolverSupport
org.springframework.web.reactive.result.method.annotation.AbstractMessageReaderArgumentResolver
- All Implemented Interfaces:
HandlerMethodArgumentResolver
- Direct Known Subclasses:
HttpEntityMethodArgumentResolver
,RequestBodyMethodArgumentResolver
,RequestPartMethodArgumentResolver
public abstract class AbstractMessageReaderArgumentResolver
extends HandlerMethodArgumentResolverSupport
Abstract base class for argument resolvers that resolve method arguments
by reading the request body with an
HttpMessageReader
.
Applies validation if the method argument is annotated with any
annotations that trigger validation. Validation failure results in a
ServerWebInputException
.
- Since:
- 5.0
- Author:
- Rossen Stoyanchev, Sebastien Deleuze
-
Field Summary
Fields inherited from class org.springframework.web.reactive.result.method.HandlerMethodArgumentResolverSupport
logger
-
Constructor Summary
ModifierConstructorDescriptionprotected
AbstractMessageReaderArgumentResolver
(List<HttpMessageReader<?>> readers) Constructor withHttpMessageReader
's and aValidator
.protected
AbstractMessageReaderArgumentResolver
(List<HttpMessageReader<?>> messageReaders, ReactiveAdapterRegistry adapterRegistry) Constructor that also accepts aReactiveAdapterRegistry
. -
Method Summary
Modifier and TypeMethodDescriptionReturn the configured message converters.protected reactor.core.publisher.Mono<Object>
readBody
(MethodParameter bodyParameter, boolean isBodyRequired, BindingContext bindingContext, ServerWebExchange exchange) Read the body from a method argument withHttpMessageReader
.protected reactor.core.publisher.Mono<Object>
readBody
(MethodParameter bodyParam, MethodParameter actualParam, boolean isBodyRequired, BindingContext bindingContext, ServerWebExchange exchange) Read the body from a method argument withHttpMessageReader
.Methods inherited from class org.springframework.web.reactive.result.method.HandlerMethodArgumentResolverSupport
checkAnnotatedParamNoReactiveWrapper, checkParameterType, checkParameterTypeNoReactiveWrapper, getAdapterRegistry
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.springframework.web.reactive.result.method.HandlerMethodArgumentResolver
resolveArgument, supportsParameter
-
Constructor Details
-
AbstractMessageReaderArgumentResolver
Constructor withHttpMessageReader
's and aValidator
.- Parameters:
readers
- the readers to convert from the request body
-
AbstractMessageReaderArgumentResolver
protected AbstractMessageReaderArgumentResolver(List<HttpMessageReader<?>> messageReaders, ReactiveAdapterRegistry adapterRegistry) Constructor that also accepts aReactiveAdapterRegistry
.- Parameters:
messageReaders
- readers to convert from the request bodyadapterRegistry
- for adapting to other reactive types from Flux and Mono
-
-
Method Details
-
getMessageReaders
Return the configured message converters. -
readBody
protected reactor.core.publisher.Mono<Object> readBody(MethodParameter bodyParameter, boolean isBodyRequired, BindingContext bindingContext, ServerWebExchange exchange) Read the body from a method argument withHttpMessageReader
.- Parameters:
bodyParameter
- theMethodParameter
to readisBodyRequired
- true if the body is requiredbindingContext
- the binding context to useexchange
- the current exchange- Returns:
- the body
- See Also:
-
readBody
protected reactor.core.publisher.Mono<Object> readBody(MethodParameter bodyParam, @Nullable MethodParameter actualParam, boolean isBodyRequired, BindingContext bindingContext, ServerWebExchange exchange) Read the body from a method argument withHttpMessageReader
.- Parameters:
bodyParam
- represents the element type for the bodyactualParam
- the actual method argument type; possibly different frombodyParam
, e.g. for anHttpEntity
argumentisBodyRequired
- true if the body is requiredbindingContext
- the binding context to useexchange
- the current exchange- Returns:
- a Mono with the value to use for the method argument
- Since:
- 5.0.2
-