org.springframework.web.servlet.mvc.multiaction
Class PropertiesMethodNameResolver

java.lang.Object
  extended byorg.springframework.web.servlet.mvc.multiaction.AbstractUrlMethodNameResolver
      extended byorg.springframework.web.servlet.mvc.multiaction.PropertiesMethodNameResolver
All Implemented Interfaces:
InitializingBean, MethodNameResolver

public class PropertiesMethodNameResolver
extends AbstractUrlMethodNameResolver
implements InitializingBean

The most sophisticated and useful framework implementation of the MethodNameResolver interface. Uses java.util.Properties defining the mapping between the URL of incoming requests and 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 PathMatcher class.

Author:
Rod Johnson, Juergen Hoeller
See Also:
Properties, PathMatcher

Field Summary
 
Fields inherited from class org.springframework.web.servlet.mvc.multiaction.AbstractUrlMethodNameResolver
logger
 
Constructor Summary
PropertiesMethodNameResolver()
           
 
Method Summary
 void afterPropertiesSet()
          Invoked by a BeanFactory after it has set all bean properties supplied (and satisfied BeanFactoryAware and ApplicationContextAware).
protected  String getHandlerMethodNameForUrlPath(String urlPath)
          Return a method name that can handle this request, based on the given lookup path.
 void setMappings(Properties mappings)
          Set URL to method name mappings from a Properties object.
 
Methods inherited from class org.springframework.web.servlet.mvc.multiaction.AbstractUrlMethodNameResolver
getHandlerMethodName, setAlwaysUseFullPath, setUrlDecode, setUrlPathHelper
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PropertiesMethodNameResolver

public PropertiesMethodNameResolver()
Method Detail

setMappings

public void setMappings(Properties mappings)
Set URL to method name mappings from a Properties object.

Parameters:
mappings - properties with URL as key and method name as value

afterPropertiesSet

public void afterPropertiesSet()
Description copied from interface: InitializingBean
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.

Specified by:
afterPropertiesSet in interface InitializingBean

getHandlerMethodNameForUrlPath

protected String getHandlerMethodNameForUrlPath(String urlPath)
Description copied from class: AbstractUrlMethodNameResolver
Return a method name that can handle this request, based on the given lookup path. Called by this class' 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)


Copyright (C) 2003-2004 The Spring Framework Project.