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

java.lang.Object
  extended by org.springframework.web.servlet.mvc.multiaction.AbstractUrlMethodNameResolver
      extended by org.springframework.web.servlet.mvc.multiaction.InternalPathMethodNameResolver
All Implemented Interfaces:
MethodNameResolver

public class InternalPathMethodNameResolver
extends AbstractUrlMethodNameResolver

Simple implementation of MethodNameResolver that maps URL to method name. Although this is the default implementation used by the MultiActionController class (because it requires no configuration), it's bit naive for most applications. In particular, we don't usually want to tie URL to implementation methods.

Maps the resource name after the last slash, ignoring an extension. E.g. "/foo/bar/baz.html" to "baz", assuming a "/foo/bar/baz.html" controller mapping to the corresponding MultiActionController handler. method. Doesn't support wildcards.

Author:
Rod Johnson, Juergen Hoeller

Field Summary
 
Fields inherited from class org.springframework.web.servlet.mvc.multiaction.AbstractUrlMethodNameResolver
logger
 
Constructor Summary
InternalPathMethodNameResolver()
           
 
Method Summary
protected  String getHandlerMethodNameForUrlPath(String urlPath)
          Return a method name that can handle this request, based on the given lookup path.
 void setPrefix(String prefix)
          Specify a common prefix for handler method names.
 void setSuffix(String suffix)
          Specify a common suffix for handler method names.
 
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

InternalPathMethodNameResolver

public InternalPathMethodNameResolver()
Method Detail

setPrefix

public void setPrefix(String prefix)
Specify a common prefix for handler method names. Will be prepended to the internal path found in the URL: e.g. internal path "baz", prefix "my" -> method name "mybaz".


setSuffix

public void setSuffix(String suffix)
Specify a common suffix for handler method names. Will be appended to the internal path found in the URL: e.g. internal path "baz", suffix "Handler" -> method name "bazHandler".


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) 2002-2005 The Spring Framework Project.