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.
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,
java.lang.Object value,
org.springframework.web.util.UriComponentsBuilder builder,
java.util.Map<java.lang.String,java.lang.Object> uriVariables,
org.springframework.core.convert.ConversionService conversionService) |
protected org.springframework.web.method.annotation.AbstractNamedValueMethodArgumentResolver.NamedValueInfo |
createNamedValueInfo(org.springframework.core.MethodParameter parameter) |
protected java.lang.String |
formatUriValue(org.springframework.core.convert.ConversionService cs,
org.springframework.core.convert.TypeDescriptor sourceType,
java.lang.Object value) |
protected void |
handleMissingValue(java.lang.String name,
org.springframework.core.MethodParameter parameter) |
protected void |
handleResolvedValue(java.lang.Object arg,
java.lang.String name,
org.springframework.core.MethodParameter parameter,
org.springframework.web.method.support.ModelAndViewContainer mavContainer,
org.springframework.web.context.request.NativeWebRequest request) |
protected java.lang.Object |
resolveName(java.lang.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.HandlerMethodArgumentResolver
supportsParameter
in interface org.springframework.web.method.support.UriComponentsContributor
protected org.springframework.web.method.annotation.AbstractNamedValueMethodArgumentResolver.NamedValueInfo createNamedValueInfo(org.springframework.core.MethodParameter parameter)
createNamedValueInfo
in class org.springframework.web.method.annotation.AbstractNamedValueMethodArgumentResolver
@Nullable protected java.lang.Object resolveName(java.lang.String name, org.springframework.core.MethodParameter parameter, org.springframework.web.context.request.NativeWebRequest request) throws java.lang.Exception
resolveName
in class org.springframework.web.method.annotation.AbstractNamedValueMethodArgumentResolver
java.lang.Exception
protected void handleMissingValue(java.lang.String name, org.springframework.core.MethodParameter parameter) throws org.springframework.web.bind.ServletRequestBindingException
handleMissingValue
in class org.springframework.web.method.annotation.AbstractNamedValueMethodArgumentResolver
org.springframework.web.bind.ServletRequestBindingException
protected void handleResolvedValue(@Nullable java.lang.Object arg, java.lang.String name, org.springframework.core.MethodParameter parameter, @Nullable org.springframework.web.method.support.ModelAndViewContainer mavContainer, org.springframework.web.context.request.NativeWebRequest request)
handleResolvedValue
in class org.springframework.web.method.annotation.AbstractNamedValueMethodArgumentResolver
public void contributeMethodArgument(org.springframework.core.MethodParameter parameter, java.lang.Object value, org.springframework.web.util.UriComponentsBuilder builder, java.util.Map<java.lang.String,java.lang.Object> uriVariables, org.springframework.core.convert.ConversionService conversionService)
contributeMethodArgument
in interface org.springframework.web.method.support.UriComponentsContributor
@Nullable protected java.lang.String formatUriValue(@Nullable org.springframework.core.convert.ConversionService cs, @Nullable org.springframework.core.convert.TypeDescriptor sourceType, java.lang.Object value)