类 AbstractMapBasedHandlerMapping<K>
- java.lang.Object
- org.springframework.context.support.ApplicationObjectSupport
- org.springframework.web.portlet.handler.AbstractHandlerMapping
- org.springframework.web.portlet.handler.AbstractMapBasedHandlerMapping<K>
- 所有已实现的接口:
Aware
,ApplicationContextAware
,Ordered
,HandlerMapping
- 直接已知子类:
DefaultAnnotationHandlerMapping
,ParameterHandlerMapping
,PortletModeHandlerMapping
,PortletModeParameterHandlerMapping
public abstract class AbstractMapBasedHandlerMapping<K> extends AbstractHandlerMapping
Abstract base class forHandlerMapping
implementations that rely on a map which caches handler objects per lookup key. Supports arbitrary lookup keys, and automatically resolves handler bean names into handler bean instances.- 从以下版本开始:
- 2.0
- 作者:
- Juergen Hoeller
- 另请参阅:
getLookupKey(javax.portlet.PortletRequest)
,registerHandler(Object, Object)
嵌套类概要
嵌套类 修饰符和类型 类 说明 protected static interface
AbstractMapBasedHandlerMapping.PortletRequestMappingPredicate
Predicate interface for determining a match with a given request.
字段概要
从类继承的字段 org.springframework.context.support.ApplicationObjectSupport
logger
从接口继承的字段 org.springframework.core.Ordered
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE
构造器概要
构造器 构造器 说明 AbstractMapBasedHandlerMapping()
方法概要
所有方法 实例方法 抽象方法 具体方法 修饰符和类型 方法 说明 protected Object
getHandlerInternal(PortletRequest request)
Determines a handler for the computed lookup key for the given request.protected abstract K
getLookupKey(PortletRequest request)
Build a lookup key for the given request.protected void
registerHandler(K lookupKey, Object handler)
Register the given handler instance for the given parameter value.protected void
registerHandler(K lookupKey, Object handler, AbstractMapBasedHandlerMapping.PortletRequestMappingPredicate predicate)
Register the given handler instance for the given parameter value.protected void
registerHandlers(Map<K,?> handlerMap)
Register all handlers specified in the Portlet mode map for the corresponding modes.void
setLazyInitHandlers(boolean lazyInitHandlers)
Set whether to lazily initialize handlers.从类继承的方法 org.springframework.web.portlet.handler.AbstractHandlerMapping
adaptInterceptor, extendInterceptors, getAdaptedInterceptors, getDefaultHandler, getHandler, getHandlerExecutionChain, getOrder, initApplicationContext, initInterceptors, setApplyWebRequestInterceptorsToRenderPhaseOnly, setDefaultHandler, setInterceptors, setOrder
从类继承的方法 org.springframework.context.support.ApplicationObjectSupport
getApplicationContext, getMessageSourceAccessor, initApplicationContext, isContextRequired, requiredContextClass, setApplicationContext
构造器详细资料
AbstractMapBasedHandlerMapping
public AbstractMapBasedHandlerMapping()
方法详细资料
setLazyInitHandlers
public void setLazyInitHandlers(boolean lazyInitHandlers)
Set whether to lazily initialize handlers. Only applicable to singleton handlers, as prototypes are always lazily initialized. Default is false, as eager initialization allows for more efficiency through referencing the handler objects directly.If you want to allow your handlers to be lazily initialized, make them "lazy-init" and set this flag to true. Just making them "lazy-init" will not work, as they are initialized through the references from the handler mapping in this case.
getHandlerInternal
protected Object getHandlerInternal(PortletRequest request) throws Exception
Determines a handler for the computed lookup key for the given request.- 指定者:
getHandlerInternal
在类中AbstractHandlerMapping
- 参数:
request
- current portlet request- 返回:
- the corresponding handler instance, or
null
if none found - 抛出:
Exception
- if there is an internal error- 另请参阅:
getLookupKey(javax.portlet.PortletRequest)
getLookupKey
protected abstract K getLookupKey(PortletRequest request) throws Exception
Build a lookup key for the given request.- 参数:
request
- current portlet request- 返回:
- the lookup key (never
null
) - 抛出:
Exception
- if key computation failed
registerHandlers
protected void registerHandlers(Map<K,?> handlerMap) throws BeansException
Register all handlers specified in the Portlet mode map for the corresponding modes.- 参数:
handlerMap
- Map with lookup keys as keys and handler beans or bean names as values- 抛出:
BeansException
- if the handler couldn't be registered
registerHandler
protected void registerHandler(K lookupKey, Object handler) throws BeansException, IllegalStateException
Register the given handler instance for the given parameter value.- 参数:
lookupKey
- the key to map the handler ontohandler
- the handler instance or handler bean name String (a bean name will automatically be resolved into the corresponding handler bean)- 抛出:
BeansException
- if the handler couldn't be registeredIllegalStateException
- if there is a conflicting handler registered
registerHandler
protected void registerHandler(K lookupKey, Object handler, AbstractMapBasedHandlerMapping.PortletRequestMappingPredicate predicate) throws BeansException, IllegalStateException
Register the given handler instance for the given parameter value.- 参数:
lookupKey
- the key to map the handler ontohandler
- the handler instance or handler bean name String (a bean name will automatically be resolved into the corresponding handler bean)predicate
- a predicate object for this handler (may benull
), determining a match with the primary lookup key- 抛出:
BeansException
- if the handler couldn't be registeredIllegalStateException
- if there is a conflicting handler registered