public class PathVariableMethodArgumentResolver
extends org.springframework.web.method.annotation.AbstractNamedValueMethodArgumentResolver
implements org.springframework.web.method.support.UriComponentsContributor
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
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.
Or if the annotation does not specify name the
RequestParamMapMethodArgumentResolver is used instead to provide
access to all URI variables in a map.
A WebDataBinder is invoked to apply type conversion to resolved
path variable values that don't yet match the method parameter type.
| Constructor and Description |
|---|
PathVariableMethodArgumentResolver() |
| Modifier and Type | Method and Description |
|---|---|
void |
contributeMethodArgument(org.springframework.core.MethodParameter parameter,
Object value,
org.springframework.web.util.UriComponentsBuilder builder,
Map<String,Object> uriVariables,
org.springframework.core.convert.ConversionService conversionService) |
protected org.springframework.web.method.annotation.AbstractNamedValueMethodArgumentResolver.NamedValueInfo |
createNamedValueInfo(org.springframework.core.MethodParameter parameter) |
protected void |
handleMissingValue(String name,
org.springframework.core.MethodParameter param) |
protected void |
handleResolvedValue(Object arg,
String name,
org.springframework.core.MethodParameter parameter,
org.springframework.web.method.support.ModelAndViewContainer mavContainer,
org.springframework.web.context.request.NativeWebRequest request) |
protected Object |
resolveName(String name,
org.springframework.core.MethodParameter parameter,
org.springframework.web.context.request.NativeWebRequest request) |
boolean |
supportsParameter(org.springframework.core.MethodParameter parameter) |
public boolean supportsParameter(org.springframework.core.MethodParameter parameter)
supportsParameter in interface org.springframework.web.method.support.HandlerMethodArgumentResolversupportsParameter in interface org.springframework.web.method.support.UriComponentsContributorprotected org.springframework.web.method.annotation.AbstractNamedValueMethodArgumentResolver.NamedValueInfo createNamedValueInfo(org.springframework.core.MethodParameter parameter)
createNamedValueInfo in class org.springframework.web.method.annotation.AbstractNamedValueMethodArgumentResolverprotected Object resolveName(String name, org.springframework.core.MethodParameter parameter, org.springframework.web.context.request.NativeWebRequest request) throws Exception
resolveName in class org.springframework.web.method.annotation.AbstractNamedValueMethodArgumentResolverExceptionprotected void handleMissingValue(String name, org.springframework.core.MethodParameter param) throws org.springframework.web.bind.ServletRequestBindingException
handleMissingValue in class org.springframework.web.method.annotation.AbstractNamedValueMethodArgumentResolverorg.springframework.web.bind.ServletRequestBindingExceptionprotected void handleResolvedValue(Object arg, String name, org.springframework.core.MethodParameter parameter, org.springframework.web.method.support.ModelAndViewContainer mavContainer, org.springframework.web.context.request.NativeWebRequest request)
handleResolvedValue in class org.springframework.web.method.annotation.AbstractNamedValueMethodArgumentResolverpublic void contributeMethodArgument(org.springframework.core.MethodParameter parameter,
Object value,
org.springframework.web.util.UriComponentsBuilder builder,
Map<String,Object> uriVariables,
org.springframework.core.convert.ConversionService conversionService)
contributeMethodArgument in interface org.springframework.web.method.support.UriComponentsContributor