org.springframework.web.servlet.mvc.multiaction
Class PropertiesMethodNameResolver
java.lang.Object
org.springframework.web.servlet.mvc.multiaction.AbstractUrlMethodNameResolver
org.springframework.web.servlet.mvc.multiaction.PropertiesMethodNameResolver
- All Implemented Interfaces:
- org.springframework.beans.factory.InitializingBean, MethodNameResolver
public class PropertiesMethodNameResolver
- extends AbstractUrlMethodNameResolver
- implements org.springframework.beans.factory.InitializingBean
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.
- Author:
- Rod Johnson, Juergen Hoeller
- See Also:
Properties
,
AntPathMatcher
Method Summary |
void |
afterPropertiesSet()
|
protected java.lang.String |
getHandlerMethodNameForUrlPath(java.lang.String urlPath)
Return a method name that can handle this request, based on the
given lookup path. |
void |
setMappings(java.util.Properties mappings)
Set explicit URL to method name mappings through a Properties object. |
void |
setPathMatcher(org.springframework.util.PathMatcher pathMatcher)
Set the PathMatcher implementation to use for matching URL paths
against registered URL patterns. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
PropertiesMethodNameResolver
public PropertiesMethodNameResolver()
setMappings
public void setMappings(java.util.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
setPathMatcher
public void setPathMatcher(org.springframework.util.PathMatcher pathMatcher)
- Set the PathMatcher implementation to use for matching URL paths
against registered URL patterns. Default is AntPathMatcher.
- See Also:
AntPathMatcher
afterPropertiesSet
public void afterPropertiesSet()
- Specified by:
afterPropertiesSet
in interface org.springframework.beans.factory.InitializingBean
getHandlerMethodNameForUrlPath
protected java.lang.String getHandlerMethodNameForUrlPath(java.lang.String urlPath)
- Description copied from class:
AbstractUrlMethodNameResolver
- Return a method name that can handle this request, based on the
given lookup path. Called by
getHandlerMethodName
.
- Specified by:
getHandlerMethodNameForUrlPath
in class AbstractUrlMethodNameResolver
- 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.
- See Also:
AbstractUrlMethodNameResolver.getHandlerMethodName(javax.servlet.http.HttpServletRequest)
,
AbstractUrlMethodNameResolver.setAlwaysUseFullPath(boolean)
,
AbstractUrlMethodNameResolver.setUrlDecode(boolean)