站内搜索: 请输入搜索关键词
当前页面: 在线文档首页 > Spring Framework 1.2.9 API 文档英文版

AbstractHandlerMapping (Spring Framework) - Spring Framework 1.2.9 API 文档英文版


org.springframework.web.servlet.handler
Class AbstractHandlerMapping

java.lang.Object
  extended by org.springframework.context.support.ApplicationObjectSupport
      extended by org.springframework.web.context.support.WebApplicationObjectSupport
          extended by org.springframework.web.servlet.handler.AbstractHandlerMapping
All Implemented Interfaces:
ApplicationContextAware, Ordered, HandlerMapping
Direct Known Subclasses:
AbstractUrlHandlerMapping

public abstract class AbstractHandlerMapping
extends WebApplicationObjectSupport
implements HandlerMapping, Ordered

Abstract base class for HandlerMapping implementations. Supports ordering, a default handler, and handler interceptors.

Since:
07.04.2003
Author:
Juergen Hoeller
See Also:
getHandlerInternal(javax.servlet.http.HttpServletRequest), setDefaultHandler(java.lang.Object), setInterceptors(org.springframework.web.servlet.HandlerInterceptor[]), HandlerInterceptor

Field Summary
 
Fields inherited from class org.springframework.context.support.ApplicationObjectSupport
logger
 
Constructor Summary
AbstractHandlerMapping()
           
 
Method Summary
 Object getDefaultHandler()
          Return the default handler for this handler mapping.
 HandlerExecutionChain getHandler(HttpServletRequest request)
          Look up a handler for the given request, falling back to the default handler if no specific one is found.
protected abstract  Object getHandlerInternal(HttpServletRequest request)
          Look up a handler for the given request, returning null if no specific one is found.
 int getOrder()
          Return the order value of this object, higher value meaning greater in terms of sorting.
 void setDefaultHandler(Object defaultHandler)
          Set the default handler for this handler mapping.
 void setInterceptors(HandlerInterceptor[] interceptors)
          Set the handler interceptors to apply for all handlers mapped by this handler mapping.
 void setOrder(int order)
           
 
Methods inherited from class org.springframework.web.context.support.WebApplicationObjectSupport
getServletContext, getTempDir, getWebApplicationContext, isContextRequired
 
Methods inherited from class org.springframework.context.support.ApplicationObjectSupport
getApplicationContext, getMessageSourceAccessor, initApplicationContext, requiredContextClass, setApplicationContext
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractHandlerMapping

public AbstractHandlerMapping()
Method Detail

setOrder

public final void setOrder(int order)

getOrder

public final int getOrder()
Description copied from interface: Ordered
Return the order value of this object, higher value meaning greater in terms of sorting. Normally starting with 0 or 1, Integer.MAX_VALUE indicating greatest. Same order values will result in arbitrary positions for the affected objects.

Higher value can be interpreted as lower priority, consequently the first object has highest priority (somewhat analogous to Servlet "load-on-startup" values).

Specified by:
getOrder in interface Ordered
Returns:
the order value

setDefaultHandler

public final void setDefaultHandler(Object defaultHandler)
Set the default handler for this handler mapping. This handler will be returned if no specific mapping was found.

Default is null, indicating no default handler.

Parameters:
defaultHandler - default handler instance, or null if none

getDefaultHandler

public final Object getDefaultHandler()
Return the default handler for this handler mapping.

Returns:
the default handler instance, or null if none

setInterceptors

public final void setInterceptors(HandlerInterceptor[] interceptors)
Set the handler interceptors to apply for all handlers mapped by this handler mapping.

Parameters:
interceptors - array of handler interceptors, or null if none

getHandler

public final HandlerExecutionChain getHandler(HttpServletRequest request)
                                       throws Exception
Look up a handler for the given request, falling back to the default handler if no specific one is found.

Specified by:
getHandler in interface HandlerMapping
Parameters:
request - current HTTP request
Returns:
the corresponding handler instance, or the default handler
Throws:
Exception - if there is an internal error
See Also:
getHandlerInternal(javax.servlet.http.HttpServletRequest)

getHandlerInternal

protected abstract Object getHandlerInternal(HttpServletRequest request)
                                      throws Exception
Look up a handler for the given request, returning null if no specific one is found. This method is called by getHandler; a null return value will lead to the default handler, if one is set.

Parameters:
request - current HTTP request
Returns:
the corresponding handler instance, or null if none found
Throws:
Exception - if there is an internal error


Copyright (c) 2002-2007 The Spring Framework Project.