Top Description Inners Fields Constructors Methods
org.springframework.web.reactive.result.method.annotation

public Class RequestParamMethodArgumentResolver

extends AbstractNamedValueSyncArgumentResolver
Class Inheritance
Imports
java.util.List, .Map, org.springframework.beans.BeanUtils, org.springframework.beans.factory.config.ConfigurableBeanFactory, org.springframework.core.MethodParameter, .ReactiveAdapterRegistry, org.springframework.core.convert.converter.Converter, org.springframework.lang.Nullable, org.springframework.util.StringUtils, org.springframework.web.bind.annotation.RequestParam, .ValueConstants, org.springframework.web.server.MissingRequestValueException, .ServerWebExchange

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.

Author
Rossen Stoyanchev
Since
5.0
See Also
RequestParamMapMethodArgumentResolver

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class

Field Summary

Modifier and TypeField and Description
private final boolean

Constructor Summary

AccessConstructor and Description
public
RequestParamMethodArgumentResolver(ConfigurableBeanFactory
a bean factory used for resolving ${...} placeholder and #{...} SpEL expressions in default values, or null if default values are not expected to contain expressions
factory
,
ReactiveAdapterRegistry
for checking reactive type wrappers
registry
,
boolean
in default resolution mode a method argument that is a simple type, as defined in BeanUtils#isSimpleProperty, is treated as a request parameter even if it isn't annotated, the request parameter name is derived from the method parameter name.
useDefaultResolution
)

Class constructor with a default resolution mode flag.

Method Summary

Modifier and TypeMethod and Description
protected AbstractNamedValueArgumentResolver.NamedValueInfo
protected void
handleMissingValue(String
the name for the value
name
,
MethodParameter
the method parameter
parameter
,
ServerWebExchange
the current exchange
exchange
)

Overrides org.springframework.web.reactive.result.method.annotation.AbstractNamedValueArgumentResolver.handleMissingValue.

Invoked when a named value is required, but resolveName(String, MethodParameter, ServerWebExchange) returned null and there is no default value.

protected Object
private boolean
singleParam(RequestParam requestParam, Class<?> type)

public boolean
supportsParameter(MethodParameter
the method parameter
param
)

Implements org.springframework.web.reactive.result.method.HandlerMethodArgumentResolver.supportsParameter.

Whether this resolver supports the given method parameter.

Inherited from org.springframework.web.reactive.result.method.annotation.AbstractNamedValueSyncArgumentResolver:
resolveArgumentresolveArgumentValueresolveName

Field Detail

useDefaultResolutionback to summary
private final boolean useDefaultResolution

Constructor Detail

RequestParamMethodArgumentResolverback to summary
public RequestParamMethodArgumentResolver(ConfigurableBeanFactory factory, ReactiveAdapterRegistry registry, boolean useDefaultResolution)

Class constructor with a default resolution mode flag.

Parameters
factory:ConfigurableBeanFactory

a bean factory used for resolving ${...} placeholder and #{...} SpEL expressions in default values, or null if default values are not expected to contain expressions

registry:ReactiveAdapterRegistry

for checking reactive type wrappers

useDefaultResolution:boolean

in default resolution mode a method argument that is a simple type, as defined in BeanUtils#isSimpleProperty, is treated as a request parameter even if it isn't annotated, the request parameter name is derived from the method parameter name.

Method Detail

createNamedValueInfoback to summary
protected AbstractNamedValueArgumentResolver.NamedValueInfo createNamedValueInfo(MethodParameter parameter)

Implements abstract org.springframework.web.reactive.result.method.annotation.AbstractNamedValueArgumentResolver.createNamedValueInfo.

Doc from org.springframework.web.reactive.result.method.annotation.AbstractNamedValueArgumentResolver.createNamedValueInfo.

Create the NamedValueInfo object for the given method parameter. Implementations typically retrieve the method annotation by means of MethodParameter#getParameterAnnotation(Class).

Parameters
parameter:MethodParameter

the method parameter

Returns:AbstractNamedValueArgumentResolver.NamedValueInfo

the named value information

Annotations
@Override
handleMissingValueback to summary
protected void handleMissingValue(String name, MethodParameter parameter, ServerWebExchange exchange)

Overrides org.springframework.web.reactive.result.method.annotation.AbstractNamedValueArgumentResolver.handleMissingValue.

Doc from org.springframework.web.reactive.result.method.annotation.AbstractNamedValueArgumentResolver.handleMissingValue.

Invoked when a named value is required, but resolveName(String, MethodParameter, ServerWebExchange) returned null and there is no default value. Subclasses typically throw an exception in this case.

Parameters
name:String

the name for the value

parameter:MethodParameter

the method parameter

exchange:ServerWebExchange

the current exchange

Annotations
@Override
resolveNamedValueback to summary
protected Object resolveNamedValue(String name, MethodParameter parameter, ServerWebExchange exchange)

Implements abstract org.springframework.web.reactive.result.method.annotation.AbstractNamedValueSyncArgumentResolver.resolveNamedValue.

Doc from org.springframework.web.reactive.result.method.annotation.AbstractNamedValueSyncArgumentResolver.resolveNamedValue.

Actually resolve the value synchronously.

Annotations
@Override
singleParamback to summary
private boolean singleParam(RequestParam requestParam, Class<?> type)
supportsParameterback to summary
public boolean supportsParameter(MethodParameter param)

Implements org.springframework.web.reactive.result.method.HandlerMethodArgumentResolver.supportsParameter.

Doc from org.springframework.web.reactive.result.method.HandlerMethodArgumentResolver.supportsParameter.

Whether this resolver supports the given method parameter.

Parameters
param:MethodParameter

the method parameter

Annotations
@Override
org.springframework.web.reactive.result.method.annotation back to summary

private Class RequestParamMethodArgumentResolver.RequestParamNamedValueInfo

extends NamedValueInfo
Class Inheritance

Constructor Summary

AccessConstructor and Description
pack-priv
pack-priv

Constructor Detail

RequestParamNamedValueInfoback to summary
pack-priv RequestParamNamedValueInfo()
RequestParamNamedValueInfoback to summary
pack-priv RequestParamNamedValueInfo(RequestParam annotation)