public class PortletModeHandlerMapping extends AbstractMapBasedHandlerMapping<PortletMode>
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>
AbstractMapBasedHandlerMapping.PortletRequestMappingPredicate
Modifier and Type | Field and Description |
---|---|
private java.util.Map<java.lang.String,java.lang.Object> |
portletModeMap |
logger
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE
Constructor and Description |
---|
PortletModeHandlerMapping() |
Modifier and Type | Method and Description |
---|---|
protected PortletMode |
getLookupKey(PortletRequest request)
Uses the current PortletMode as lookup key.
|
void |
initApplicationContext()
Calls the
registerHandlers method in addition
to the superclass's initialization. |
protected void |
registerHandlersByMode(java.util.Map<java.lang.String,java.lang.Object> portletModeMap)
Register all handlers specified in the Portlet mode map for the corresponding modes.
|
void |
setMappings(java.util.Properties mappings)
Set PortletMode to handler bean name mappings from a Properties object.
|
void |
setPortletModeMap(java.util.Map<java.lang.String,?> portletModeMap)
Set a Map with PortletModes as keys and handler beans as values.
|
getHandlerInternal, registerHandler, registerHandler, registerHandlers, setLazyInitHandlers
adaptInterceptor, extendInterceptors, getAdaptedInterceptors, getDefaultHandler, getHandler, getHandlerExecutionChain, getOrder, initInterceptors, setApplyWebRequestInterceptorsToRenderPhaseOnly, setDefaultHandler, setInterceptors, setOrder
getApplicationContext, getMessageSourceAccessor, initApplicationContext, isContextRequired, requiredContextClass, setApplicationContext
private final java.util.Map<java.lang.String,java.lang.Object> portletModeMap
public void setMappings(java.util.Properties mappings)
mappings
- properties with PortletMode names as keys and bean names as valuespublic void setPortletModeMap(java.util.Map<java.lang.String,?> portletModeMap)
portletModeMap
- map with PortletMode names as keys and beans or bean names as valuespublic void initApplicationContext() throws BeansException
registerHandlers
method in addition
to the superclass's initialization.initApplicationContext
in class AbstractHandlerMapping
ApplicationContextException
- in case of initialization errorsBeansException
- if thrown by ApplicationContext methodsAbstractMapBasedHandlerMapping.registerHandlers(java.util.Map<K, ?>)
protected void registerHandlersByMode(java.util.Map<java.lang.String,java.lang.Object> portletModeMap)
portletModeMap
- Map with mode names as keys and handler beans or bean names as valuesprotected PortletMode getLookupKey(PortletRequest request) throws java.lang.Exception
getLookupKey
in class AbstractMapBasedHandlerMapping<PortletMode>
request
- current portlet requestnull
)java.lang.Exception
- if key computation failed