org.springframework.web.portlet.handler
Class PortletModeHandlerMapping
java.lang.Object
org.springframework.context.support.ApplicationObjectSupport
org.springframework.web.portlet.handler.AbstractHandlerMapping
org.springframework.web.portlet.handler.AbstractMapBasedHandlerMapping<PortletMode>
org.springframework.web.portlet.handler.PortletModeHandlerMapping
- All Implemented Interfaces:
- Aware, ApplicationContextAware, Ordered, HandlerMapping
public class PortletModeHandlerMapping
- extends AbstractMapBasedHandlerMapping<PortletMode>
Implementation of the HandlerMapping
interface to map from the current PortletMode to request handler beans.
The bean configuration for this mapping will look something like this:
<bean id="portletModeHandlerMapping" class="org.springframework.web.portlet.handler.PortletModeHandlerMapping">
<property name="portletModeMap">
<map>
<entry key="view"><ref bean="viewHandler"/></entry>
<entry key="edit"><ref bean="editHandler"/></entry>
<entry key="help"><ref bean="helpHandler"/></entry>
</map>
</property>
</bean>
- Since:
- 2.0
- Author:
- William G. Thompson, Jr., John A. Lewis
Methods inherited from class org.springframework.web.portlet.handler.AbstractHandlerMapping |
adaptInterceptor, extendInterceptors, getAdaptedInterceptors, getDefaultHandler, getHandler, getHandlerExecutionChain, getOrder, initInterceptors, setApplyWebRequestInterceptorsToRenderPhaseOnly, setDefaultHandler, setInterceptors, setOrder |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
PortletModeHandlerMapping
public PortletModeHandlerMapping()
setMappings
public void setMappings(Properties mappings)
- Set PortletMode to handler bean name mappings from a Properties object.
- Parameters:
mappings
- properties with PortletMode names as keys and bean names as values
setPortletModeMap
public void setPortletModeMap(Map<String,?> portletModeMap)
- Set a Map with PortletModes as keys and handler beans as values.
Convenient for population with bean references.
- Parameters:
portletModeMap
- map with PortletMode names as keys and beans or bean names as values
initApplicationContext
public void initApplicationContext()
throws BeansException
- Calls the
registerHandlers
method in addition
to the superclass's initialization.
- Overrides:
initApplicationContext
in class AbstractHandlerMapping
- Throws:
ApplicationContextException
- in case of initialization errors
BeansException
- if thrown by ApplicationContext methods- See Also:
AbstractMapBasedHandlerMapping.registerHandlers(java.util.Map)
registerHandlersByMode
protected void registerHandlersByMode(Map<String,Object> portletModeMap)
- Register all handlers specified in the Portlet mode map for the corresponding modes.
- Parameters:
portletModeMap
- Map with mode names as keys and handler beans or bean names as values
getLookupKey
protected PortletMode getLookupKey(PortletRequest request)
throws Exception
- Uses the current PortletMode as lookup key.
- Specified by:
getLookupKey
in class AbstractMapBasedHandlerMapping<PortletMode>
- Parameters:
request
- current portlet request
- Returns:
- the lookup key (never
null
)
- Throws:
Exception
- if key computation failed