spring-framework / org.springframework.web.servlet.mvc.method.annotation / PathVariableMethodArgumentResolver

PathVariableMethodArgumentResolver

open class PathVariableMethodArgumentResolver : AbstractNamedValueMethodArgumentResolver, UriComponentsContributor

Resolves method arguments annotated with an @PathVariable.

An @PathVariable is a named value that gets resolved from a URI template variable. It is always required and does not have a default value to fall back on. See the base class org.springframework.web.method.annotation.AbstractNamedValueMethodArgumentResolver for more information on how named values are processed.

If the method parameter type is Map, the name specified in the annotation is used to resolve the URI variable String value. The value is then converted to a Map via type conversion, assuming a suitable Converter or PropertyEditor has been registered.

A WebDataBinder is invoked to apply type conversion to resolved path variable values that don't yet match the method parameter type.

Author
Rossen Stoyanchev

Author
Arjen Poutsma

Author
Juergen Hoeller

Since
3.1

Constructors

<init>

PathVariableMethodArgumentResolver()

Resolves method arguments annotated with an @PathVariable.

An @PathVariable is a named value that gets resolved from a URI template variable. It is always required and does not have a default value to fall back on. See the base class org.springframework.web.method.annotation.AbstractNamedValueMethodArgumentResolver for more information on how named values are processed.

If the method parameter type is Map, the name specified in the annotation is used to resolve the URI variable String value. The value is then converted to a Map via type conversion, assuming a suitable Converter or PropertyEditor has been registered.

A WebDataBinder is invoked to apply type conversion to resolved path variable values that don't yet match the method parameter type.

Functions

contributeMethodArgument

open fun contributeMethodArgument(parameter: MethodParameter, value: Any, builder: UriComponentsBuilder, uriVariables: MutableMap<String, Any>, conversionService: ConversionService): Unit

supportsParameter

open fun supportsParameter(parameter: MethodParameter): Boolean

Inherited Functions

resolveArgument

fun resolveArgument(parameter: MethodParameter, mavContainer: ModelAndViewContainer, webRequest: NativeWebRequest, binderFactory: WebDataBinderFactory): Any