spring-webmvc

org.springframework.web.servlet.mvc.method.annotation
Class PathVariableMethodArgumentResolver

java.lang.Object
  extended by org.springframework.web.method.annotation.AbstractNamedValueMethodArgumentResolver
      extended by org.springframework.web.servlet.mvc.method.annotation.PathVariableMethodArgumentResolver
All Implemented Interfaces:
org.springframework.web.method.support.HandlerMethodArgumentResolver

public class PathVariableMethodArgumentResolver
extends org.springframework.web.method.annotation.AbstractNamedValueMethodArgumentResolver

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 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.

Since:
3.1
Author:
Rossen Stoyanchev, Arjen Poutsma

Nested Class Summary
 
Nested classes/interfaces inherited from class org.springframework.web.method.annotation.AbstractNamedValueMethodArgumentResolver
org.springframework.web.method.annotation.AbstractNamedValueMethodArgumentResolver.NamedValueInfo
 
Constructor Summary
PathVariableMethodArgumentResolver()
           
 
Method Summary
protected  org.springframework.web.method.annotation.AbstractNamedValueMethodArgumentResolver.NamedValueInfo createNamedValueInfo(org.springframework.core.MethodParameter parameter)
           
protected  void handleMissingValue(java.lang.String name, org.springframework.core.MethodParameter param)
           
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)
           
 
Methods inherited from class org.springframework.web.method.annotation.AbstractNamedValueMethodArgumentResolver
resolveArgument
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PathVariableMethodArgumentResolver

public PathVariableMethodArgumentResolver()
Method Detail

supportsParameter

public boolean supportsParameter(org.springframework.core.MethodParameter parameter)

createNamedValueInfo

protected org.springframework.web.method.annotation.AbstractNamedValueMethodArgumentResolver.NamedValueInfo createNamedValueInfo(org.springframework.core.MethodParameter parameter)
Specified by:
createNamedValueInfo in class org.springframework.web.method.annotation.AbstractNamedValueMethodArgumentResolver

resolveName

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
Specified by:
resolveName in class org.springframework.web.method.annotation.AbstractNamedValueMethodArgumentResolver
Throws:
java.lang.Exception

handleMissingValue

protected void handleMissingValue(java.lang.String name,
                                  org.springframework.core.MethodParameter param)
                           throws org.springframework.web.bind.ServletRequestBindingException
Specified by:
handleMissingValue in class org.springframework.web.method.annotation.AbstractNamedValueMethodArgumentResolver
Throws:
org.springframework.web.bind.ServletRequestBindingException

handleResolvedValue

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)
Overrides:
handleResolvedValue in class org.springframework.web.method.annotation.AbstractNamedValueMethodArgumentResolver

spring-webmvc