public class

PropertiesMethodNameResolver

extends AbstractUrlMethodNameResolver
implements InitializingBean
java.lang.Object
   ↳ org.springframework.web.servlet.mvc.multiaction.AbstractUrlMethodNameResolver
     ↳ org.springframework.web.servlet.mvc.multiaction.PropertiesMethodNameResolver

Class Overview

The most flexible out-of-the-box implementation of the MethodNameResolver interface. Uses java.util.Properties to define the mapping between the URL of incoming requests and the corresponding method name. Such properties can be held in an XML document.

Properties format is /welcome.html=displayGenresPage Note that method overloading isn't allowed, so there's no need to specify arguments.

Supports direct matches, e.g. a registered "/test" matches "/test", and a various Ant-style pattern matches, e.g. a registered "/t*" matches both "/test" and "/team". For details, see the AntPathMatcher javadoc.

Summary

[Expand]
Inherited Fields
From class org.springframework.web.servlet.mvc.multiaction.AbstractUrlMethodNameResolver
Public Constructors
PropertiesMethodNameResolver()
Public Methods
void afterPropertiesSet()
Invoked by a BeanFactory after it has set all bean properties supplied (and satisfied BeanFactoryAware and ApplicationContextAware).
void setMappings(Properties mappings)
Set explicit URL to method name mappings through a Properties object.
void setPathMatcher(PathMatcher pathMatcher)
Set the PathMatcher implementation to use for matching URL paths against registered URL patterns.
Protected Methods
String getHandlerMethodNameForUrlPath(String urlPath)
Return a method name that can handle this request, based on the given lookup path.
[Expand]
Inherited Methods
From class org.springframework.web.servlet.mvc.multiaction.AbstractUrlMethodNameResolver
From class java.lang.Object
From interface org.springframework.beans.factory.InitializingBean
From interface org.springframework.web.servlet.mvc.multiaction.MethodNameResolver

Public Constructors

public PropertiesMethodNameResolver ()

Public Methods

public void afterPropertiesSet ()

Invoked by a BeanFactory after it has set all bean properties supplied (and satisfied BeanFactoryAware and ApplicationContextAware).

This method allows the bean instance to perform initialization only possible when all bean properties have been set and to throw an exception in the event of misconfiguration.

public void setMappings (Properties mappings)

Set explicit URL to method name mappings through a Properties object.

Parameters
mappings Properties with URL as key and method name as value

public void setPathMatcher (PathMatcher pathMatcher)

Set the PathMatcher implementation to use for matching URL paths against registered URL patterns. Default is AntPathMatcher.

See Also

Protected Methods

protected String getHandlerMethodNameForUrlPath (String urlPath)

Return a method name that can handle this request, based on the given lookup path. Called by getHandlerMethodName.

Parameters
urlPath the URL path to use for lookup, according to the settings in this class
Returns
  • a method name that can handle this request. Should return null if no matching method found.