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

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

public abstract class AbstractUrlMethodNameResolver
extends java.lang.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 property.

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

Field Summary
protected  org.apache.commons.logging.Log logger
           
 
Constructor Summary
AbstractUrlMethodNameResolver()
           
 
Method Summary
 java.lang.String getHandlerMethodName(javax.servlet.http.HttpServletRequest request)
          This implementation of getHandlerMethodName retrieves the URL path to use for lookup and delegates to getHandlerMethodNameForUrlPath.
protected abstract  java.lang.String getHandlerMethodNameForUrlPath(java.lang.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 org.apache.commons.logging.Log logger
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 J2SE 1.4, as J2SE 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 java.lang.String getHandlerMethodName(javax.servlet.http.HttpServletRequest request)
                                            throws NoSuchRequestHandlingMethodException
This implementation of getHandlerMethodName retrieves the URL path to use for lookup and delegates to getHandlerMethodNameForUrlPath. Converts null values to NoSuchRequestHandlingMethodExceptions.

Specified by:
getHandlerMethodName in interface MethodNameResolver
Returns:
a method name that can handle this request. Never returns null; throws exception
Throws:
NoSuchRequestHandlingMethodException - if no method can be found for this URL

getHandlerMethodNameForUrlPath

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


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