Spring Framework
org.springframework.web.servlet.mvc.multiaction

Class ParameterMethodNameResolver

    • Field Summary

      Fields 
      Modifier and Type Field and Description
      static java.lang.String DEFAULT_PARAM_NAME
      Default name for the parameter whose value identifies the method to invoke: "action".
      protected org.apache.commons.logging.Log logger 
    • Method Summary

      Methods 
      Modifier and Type Method and Description
      java.lang.String getHandlerMethodName(javax.servlet.http.HttpServletRequest request)
      Return a method name that can handle this request.
      void setDefaultMethodName(java.lang.String defaultMethodName)
      Set the name of the default handler method that should be used when no parameter was found in the request
      void setLogicalMappings(java.util.Properties logicalMappings)
      Specifies a set of optional logical method name mappings.
      void setMethodParamNames(java.lang.String[] methodParamNames)
      Set a String array of parameter names, where the very existence of a parameter in the list (with value ignored) means that a method of the same name should be invoked.
      void setParamName(java.lang.String paramName)
      Set the name of the parameter whose value identifies the name of the method to invoke.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • DEFAULT_PARAM_NAME

        public static final java.lang.String DEFAULT_PARAM_NAME
        Default name for the parameter whose value identifies the method to invoke: "action".
        See Also:
        Constant Field Values
      • logger

        protected final org.apache.commons.logging.Log logger
    • Constructor Detail

      • ParameterMethodNameResolver

        public ParameterMethodNameResolver()
    • Method Detail

      • setParamName

        public void setParamName(java.lang.String paramName)
        Set the name of the parameter whose value identifies the name of the method to invoke. Default is "action".

        Alternatively, specify parameter names where the very existence of each parameter means that a method of the same name should be invoked, via the "methodParamNames" property.

        See Also:
        setMethodParamNames(java.lang.String[])
      • setMethodParamNames

        public void setMethodParamNames(java.lang.String[] methodParamNames)
        Set a String array of parameter names, where the very existence of a parameter in the list (with value ignored) means that a method of the same name should be invoked. This target method name may then be optionally further mapped via the logicalMappings property, in which case it can be considered a logical name only.
        See Also:
        setParamName(java.lang.String)
      • setLogicalMappings

        public void setLogicalMappings(java.util.Properties logicalMappings)
        Specifies a set of optional logical method name mappings. For both resolution strategies, the method name initially comes in from the view layer. If that needs to be treated as a 'logical' method name, and mapped to a 'real' method name, then a name/value pair for that purpose should be added to this Properties instance. Any method name not found in this mapping will be considered to already be the real method name.

        Note that in the case of no match, where the defaultMethodName property is used if available, that method name is considered to already be the real method name, and is not run through the logical mapping.

        Parameters:
        logicalMappings - a Properties object mapping logical method names to real method names
      • setDefaultMethodName

        public void setDefaultMethodName(java.lang.String defaultMethodName)
        Set the name of the default handler method that should be used when no parameter was found in the request
      • getHandlerMethodName

        public java.lang.String getHandlerMethodName(javax.servlet.http.HttpServletRequest request)
                                              throws NoSuchRequestHandlingMethodException
        Description copied from interface: MethodNameResolver
        Return a method name that can handle this request. Such mappings are typically, but not necessarily, based on URL.
        Specified by:
        getHandlerMethodName in interface MethodNameResolver
        Parameters:
        request - current HTTP request
        Returns:
        a method name that can handle this request. Never returns null; throws exception if not resolvable.
        Throws:
        NoSuchRequestHandlingMethodException - if no handler method can be found for the given request
Spring Framework