com.interface21.web.servlet.handler
Class AbstractUrlHandlerMapping
java.lang.Object
|
+--com.interface21.context.support.ApplicationObjectSupport
|
+--com.interface21.web.servlet.handler.AbstractHandlerMapping
|
+--com.interface21.web.servlet.handler.AbstractUrlHandlerMapping
- All Implemented Interfaces:
- ApplicationContextAware, HandlerMapping, Ordered
- Direct Known Subclasses:
- BeanNameUrlHandlerMapping, SimpleUrlHandlerMapping
- public abstract class AbstractUrlHandlerMapping
- extends AbstractHandlerMapping
Abstract base class for url-mapped HandlerMapping implementations.
Provides infrastructure for mapping handlers to URLs and configurable
URL lookup. For information on the latter, see alwaysUseFullPath property.
Supports direct matches (given "/test" -> registered "/test")
and "*" matches (given "/test" -> registered "/t*").
- Since:
- 16.04.2003
- Author:
- Juergen Hoeller
- See Also:
setAlwaysUseFullPath(boolean),
AbstractHandlerMapping.setDefaultHandler(java.lang.Object)
|
Method Summary |
protected java.lang.Object |
getHandlerInternal(javax.servlet.http.HttpServletRequest request)
Lookup a handler for the URL path of the given request. |
protected java.lang.Object |
initHandler(java.lang.String beanName,
java.lang.String urlPath)
Initialize the handler object with the given name in the bean factory.
|
protected java.lang.Object |
lookupHandler(java.lang.String urlPath)
Lookup a handler instance for the given URL path.
|
protected void |
registerHandler(java.lang.String urlPath,
java.lang.Object handler)
Register the given handler instance for the given URL path. |
void |
setAlwaysUseFullPath(boolean alwaysUseFullPath)
Set if URL lookup should always use full path within current servlet
context. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
AbstractUrlHandlerMapping
public AbstractUrlHandlerMapping()
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.
registerHandler
protected void registerHandler(java.lang.String urlPath,
java.lang.Object handler)
- Register the given handler instance for the given URL path.
- Parameters:
urlPath - URL the bean is mapped tohandler - the handler instance
lookupHandler
protected java.lang.Object lookupHandler(java.lang.String urlPath)
- Lookup a handler instance for the given URL path.
Supports direct matches (given "/test" -> registered "/test")
and "*" matches (given "/test" -> registered "/t*").
- Parameters:
urlPath - URL the bean is mapped to- Returns:
- the associated handler instance, or null if not found
initHandler
protected java.lang.Object initHandler(java.lang.String beanName,
java.lang.String urlPath)
throws ApplicationContextException
- Initialize the handler object with the given name in the bean factory.
This includes setting the LocaleResolver and mapped URL if aware.
- Parameters:
beanName - name of the bean in the application contexturlPath - URL the bean is mapped to- Returns:
- the initialized handler instance
- Throws:
ApplicationContextException - if the bean wasn't found in the context
getHandlerInternal
protected java.lang.Object getHandlerInternal(javax.servlet.http.HttpServletRequest request)
- Lookup a handler for the URL path of the given request.
- Overrides:
getHandlerInternal in class AbstractHandlerMapping
- Parameters:
request - current HTTP request- Returns:
- the looked up handler instance, or null
Rod Johnson and Spring contributors 2001-2003.