org.springframework.web.method.annotation

Class RequestParamMethodArgumentResolver

  • All Implemented Interfaces:
    HandlerMethodArgumentResolver, UriComponentsContributor


    public class RequestParamMethodArgumentResolver
    extends AbstractNamedValueMethodArgumentResolver
    implements UriComponentsContributor
    Resolves method arguments annotated with @RequestParam, arguments of type MultipartFile in conjunction with Spring's MultipartResolver abstraction, and arguments of type javax.servlet.http.Part in conjunction with Servlet 3.0 multipart requests. 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 or PropertyEditor 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.

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

    Since:
    3.1
    Author:
    Arjen Poutsma, Rossen Stoyanchev, Brian Clozel
    See Also:
    RequestParamMapMethodArgumentResolver