public abstract class

AbstractMapBasedHandlerMapping

extends AbstractHandlerMapping
java.lang.Object
   ↳ org.springframework.context.support.ApplicationObjectSupport
     ↳ org.springframework.web.portlet.handler.AbstractHandlerMapping
       ↳ org.springframework.web.portlet.handler.AbstractMapBasedHandlerMapping<K>
Known Direct Subclasses

Class Overview

Abstract base class for HandlerMapping 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.

See Also

Summary

Nested Classes
interface AbstractMapBasedHandlerMapping.PortletRequestMappingPredicate Predicate interface for determining a match with a given request. 
[Expand]
Inherited Constants
From interface org.springframework.core.Ordered
[Expand]
Inherited Fields
From class org.springframework.context.support.ApplicationObjectSupport
Public Constructors
AbstractMapBasedHandlerMapping()
Public Methods
void setLazyInitHandlers(boolean lazyInitHandlers)
Set whether to lazily initialize handlers.
Protected Methods
Object getHandlerInternal(PortletRequest request)
Determines a handler for the computed lookup key for the given request.
abstract K getLookupKey(PortletRequest request)
Build a lookup key for the given request.
void registerHandler(K lookupKey, Object handler, AbstractMapBasedHandlerMapping.PortletRequestMappingPredicate predicate)
Register the given handler instance for the given parameter value.
void registerHandler(K lookupKey, Object handler)
Register the given handler instance for the given parameter value.
void registerHandlers(Map<K, ?> handlerMap)
Register all handlers specified in the Portlet mode map for the corresponding modes.
[Expand]
Inherited Methods
From class org.springframework.web.portlet.handler.AbstractHandlerMapping
From class org.springframework.context.support.ApplicationObjectSupport
From class java.lang.Object
From interface org.springframework.context.ApplicationContextAware
From interface org.springframework.core.Ordered
From interface org.springframework.web.portlet.HandlerMapping

Public Constructors

public AbstractMapBasedHandlerMapping ()

Public Methods

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.

Protected Methods

protected Object getHandlerInternal (PortletRequest request)

Determines a handler for the computed lookup key for the given request.

Parameters
request current portlet request
Returns
  • the corresponding handler instance, or null if none found
Throws
Exception

protected abstract K getLookupKey (PortletRequest request)

Build a lookup key for the given request.

Parameters
request current portlet request
Returns
  • the lookup key (never null)
Throws
Exception if key computation failed

protected void registerHandler (K lookupKey, Object handler, AbstractMapBasedHandlerMapping.PortletRequestMappingPredicate predicate)

Register the given handler instance for the given parameter value.

Parameters
lookupKey the key to map the handler onto
handler 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 be null), determining a match with the primary lookup key
Throws
BeansException if the handler couldn't be registered
IllegalStateException if there is a conflicting handler registered

protected void registerHandler (K lookupKey, Object handler)

Register the given handler instance for the given parameter value.

Parameters
lookupKey the key to map the handler onto
handler the handler instance or handler bean name String (a bean name will automatically be resolved into the corresponding handler bean)
Throws
BeansException if the handler couldn't be registered
IllegalStateException if there is a conflicting handler registered

protected void registerHandlers (Map<K, ?> handlerMap)

Register all handlers specified in the Portlet mode map for the corresponding modes.

Parameters
handlerMap Map with lookup keys as keys and handler beans or bean names as values
Throws
BeansException if the handler couldn't be registered