public abstract class AbstractUrlMethodNameResolver extends Object implements MethodNameResolver
MethodNameResolver
implementations.
Provides infrastructure for mapping handlers to URLs and configurable
URL lookup. For information on the latter, see the
setAlwaysUseFullPath(boolean)
"alwaysUseFullPath"}
and "urlDecode"
properties.
Modifier and Type | Field and Description |
---|---|
protected Log |
logger
Logger available to subclasses
|
Constructor and Description |
---|
AbstractUrlMethodNameResolver() |
Modifier and Type | Method and Description |
---|---|
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.
|
protected final Log logger
public void setAlwaysUseFullPath(boolean alwaysUseFullPath)
public void setUrlDecode(boolean urlDecode)
Uses either the request encoding or the default encoding according to the Servlet spec (ISO-8859-1).
UrlPathHelper.setUrlDecode(boolean)
public void setUrlPathHelper(UrlPathHelper urlPathHelper)
Use this to override the default UrlPathHelper with a custom subclass, or to share common UrlPathHelper settings across multiple MethodNameResolvers and HandlerMappings.
public final String getHandlerMethodName(HttpServletRequest request) throws NoSuchRequestHandlingMethodException
getHandlerMethodNameForUrlPath
.
Converts null
values to NoSuchRequestHandlingMethodExceptions.getHandlerMethodName
in interface MethodNameResolver
request
- current HTTP requestnull
; throws exception if not resolvable.NoSuchRequestHandlingMethodException
- if no handler method
can be found for the given requestgetHandlerMethodNameForUrlPath(java.lang.String)
protected abstract String getHandlerMethodNameForUrlPath(String urlPath)
getHandlerMethodName
.urlPath
- the URL path to use for lookup,
according to the settings in this classgetHandlerMethodName(javax.servlet.http.HttpServletRequest)
,
setAlwaysUseFullPath(boolean)
,
setUrlDecode(boolean)