The Spring Framework

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

java.lang.Object
  extended by org.springframework.web.servlet.mvc.multiaction.AbstractUrlMethodNameResolver
All Implemented Interfaces:
MethodNameResolver
Direct Known Subclasses:
InternalPathMethodNameResolver, PropertiesMethodNameResolver

public abstract class AbstractUrlMethodNameResolver
extends Object
implements MethodNameResolver

Abstract base class for URL-based MethodNameResolver implementations.

Provides infrastructure for mapping handlers to URLs and configurable URL lookup. For information on the latter, see alwaysUseFullPath and urlDecode properties.

Since:
14.01.2004
Author:
Juergen Hoeller
See Also:
setAlwaysUseFullPath(boolean), setUrlDecode(boolean)

Field Summary
protected  Log logger
          Logger available to subclasses
 
Constructor Summary
AbstractUrlMethodNameResolver()
           
 
Method Summary
 String getHandlerMethodName(HttpServletRequest request)
          Retrieves the URL path to use for lookup and delegates to getHandlerMethodNameForUrlPath.
protected abstract  String getHandlerMethodNameForUrlPath(String urlPath)
          Return a method name that can handle this request, based on the given lookup path.
 void setAlwaysUseFullPath(boolean alwaysUseFullPath)
          Set if URL lookup should always use full path within current servlet context.
 void setUrlDecode(boolean urlDecode)
          Set if context path and request URI should be URL-decoded.
 void setUrlPathHelper(UrlPathHelper urlPathHelper)
          Set the UrlPathHelper to use for resolution of lookup paths.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

protected final Log logger
Logger available to subclasses

Constructor Detail

AbstractUrlMethodNameResolver

public AbstractUrlMethodNameResolver()
Method Detail

setAlwaysUseFullPath

public void setAlwaysUseFullPath(boolean alwaysUseFullPath)
Set if URL lookup should always use full path within current servlet context. Else, the path within the current servlet mapping is used if applicable (i.e. in the case of a ".../*" servlet mapping in web.xml). Default is "false".

See Also:
UrlPathHelper.setAlwaysUseFullPath(boolean)

setUrlDecode

public void setUrlDecode(boolean urlDecode)
Set if context path and request URI should be URL-decoded. Both are returned undecoded by the Servlet API, in contrast to the servlet path.

Uses either the request encoding or the default encoding according to the Servlet spec (ISO-8859-1).

Note: Setting this to "true" requires JDK 1.4 if the encoding differs from the VM's platform default encoding, as JDK 1.3's URLDecoder class does not offer a way to specify the encoding.

See Also:
UrlPathHelper.setUrlDecode(boolean)

setUrlPathHelper

public void setUrlPathHelper(UrlPathHelper urlPathHelper)
Set the UrlPathHelper to use for resolution of lookup paths.

Use this to override the default UrlPathHelper with a custom subclass, or to share common UrlPathHelper settings across multiple MethodNameResolvers and HandlerMappings.

See Also:
AbstractUrlHandlerMapping.setUrlPathHelper(org.springframework.web.util.UrlPathHelper)

getHandlerMethodName

public final String getHandlerMethodName(HttpServletRequest request)
                                  throws NoSuchRequestHandlingMethodException
Retrieves the URL path to use for lookup and delegates to getHandlerMethodNameForUrlPath. Converts null values to NoSuchRequestHandlingMethodExceptions.

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
See Also:
getHandlerMethodNameForUrlPath(java.lang.String)

getHandlerMethodNameForUrlPath

protected abstract 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.
See Also:
getHandlerMethodName(javax.servlet.http.HttpServletRequest), setAlwaysUseFullPath(boolean), setUrlDecode(boolean)

The Spring Framework

Copyright © 2002-2007 The Spring Framework.