Class RequestParamMethodArgumentResolver
java.lang.Object
org.springframework.web.reactive.result.method.HandlerMethodArgumentResolverSupport
org.springframework.web.reactive.result.method.annotation.AbstractNamedValueArgumentResolver
org.springframework.web.reactive.result.method.annotation.AbstractNamedValueSyncArgumentResolver
org.springframework.web.reactive.result.method.annotation.RequestParamMethodArgumentResolver
- All Implemented Interfaces:
HandlerMethodArgumentResolver
,SyncHandlerMethodArgumentResolver
Resolver for method arguments annotated with @
RequestParam
from URI
query string parameters.
This resolver can also be created in default resolution mode in which
simple types (int, long, etc.) not annotated with @RequestParam
are
also treated as request parameters with the parameter name derived from the
argument name.
If the method parameter type is Map
, the name specified in the
annotation is used to resolve the request parameter String value. The value is
then converted to a Map
via type conversion assuming a suitable
Converter
has been registered. Or if a request parameter name is not
specified the RequestParamMapMethodArgumentResolver
is used instead
to provide access to all request parameters in the form of a map.
- Since:
- 5.0
- Author:
- Rossen Stoyanchev
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class org.springframework.web.reactive.result.method.annotation.AbstractNamedValueArgumentResolver
AbstractNamedValueArgumentResolver.NamedValueInfo
-
Field Summary
Fields inherited from class org.springframework.web.reactive.result.method.HandlerMethodArgumentResolverSupport
logger
-
Constructor Summary
ConstructorDescriptionRequestParamMethodArgumentResolver
(ConfigurableBeanFactory factory, ReactiveAdapterRegistry registry, boolean useDefaultResolution) Class constructor with a default resolution mode flag. -
Method Summary
Modifier and TypeMethodDescriptioncreateNamedValueInfo
(MethodParameter parameter) Create theAbstractNamedValueArgumentResolver.NamedValueInfo
object for the given method parameter.protected void
handleMissingValue
(String name, MethodParameter parameter, ServerWebExchange exchange) Invoked when a named value is required, butAbstractNamedValueArgumentResolver.resolveName(String, MethodParameter, ServerWebExchange)
returnednull
and there is no default value.protected Object
resolveNamedValue
(String name, MethodParameter parameter, ServerWebExchange exchange) Actually resolve the value synchronously.boolean
supportsParameter
(MethodParameter param) Whether this resolver supports the given method parameter.Methods inherited from class org.springframework.web.reactive.result.method.annotation.AbstractNamedValueSyncArgumentResolver
resolveArgument, resolveArgumentValue, resolveName
Methods inherited from class org.springframework.web.reactive.result.method.annotation.AbstractNamedValueArgumentResolver
handleMissingValue, handleResolvedValue
Methods inherited from class org.springframework.web.reactive.result.method.HandlerMethodArgumentResolverSupport
checkAnnotatedParamNoReactiveWrapper, checkParameterType, checkParameterTypeNoReactiveWrapper, getAdapterRegistry
-
Constructor Details
-
RequestParamMethodArgumentResolver
public RequestParamMethodArgumentResolver(@Nullable ConfigurableBeanFactory factory, ReactiveAdapterRegistry registry, boolean useDefaultResolution) Class constructor with a default resolution mode flag.- Parameters:
factory
- a bean factory used for resolving ${...} placeholder and #{...} SpEL expressions in default values, ornull
if default values are not expected to contain expressionsregistry
- for checking reactive type wrappersuseDefaultResolution
- in default resolution mode a method argument that is a simple type, as defined inBeanUtils.isSimpleProperty(java.lang.Class<?>)
, is treated as a request parameter even if it isn't annotated, the request parameter name is derived from the method parameter name.
-
-
Method Details
-
supportsParameter
Description copied from interface:HandlerMethodArgumentResolver
Whether this resolver supports the given method parameter.- Parameters:
param
- the method parameter
-
createNamedValueInfo
protected AbstractNamedValueArgumentResolver.NamedValueInfo createNamedValueInfo(MethodParameter parameter) Description copied from class:AbstractNamedValueArgumentResolver
Create theAbstractNamedValueArgumentResolver.NamedValueInfo
object for the given method parameter. Implementations typically retrieve the method annotation by means ofMethodParameter.getParameterAnnotation(Class)
.- Specified by:
createNamedValueInfo
in classAbstractNamedValueArgumentResolver
- Parameters:
parameter
- the method parameter- Returns:
- the named value information
-
resolveNamedValue
@Nullable protected Object resolveNamedValue(String name, MethodParameter parameter, ServerWebExchange exchange) Description copied from class:AbstractNamedValueSyncArgumentResolver
Actually resolve the value synchronously.- Specified by:
resolveNamedValue
in classAbstractNamedValueSyncArgumentResolver
-
handleMissingValue
protected void handleMissingValue(String name, MethodParameter parameter, ServerWebExchange exchange) Description copied from class:AbstractNamedValueArgumentResolver
Invoked when a named value is required, butAbstractNamedValueArgumentResolver.resolveName(String, MethodParameter, ServerWebExchange)
returnednull
and there is no default value. Subclasses typically throw an exception in this case.- Overrides:
handleMissingValue
in classAbstractNamedValueArgumentResolver
- Parameters:
name
- the name for the valueparameter
- the method parameterexchange
- the current exchange
-