org.springframework.web.portlet.handler
public class: PortletModeHandlerMapping [javadoc |
source]
java.lang.Object
org.springframework.context.support.ApplicationObjectSupport
org.springframework.web.portlet.handler.AbstractHandlerMapping
org.springframework.web.portlet.handler.AbstractMapBasedHandlerMapping
org.springframework.web.portlet.handler.PortletModeHandlerMapping
All Implemented Interfaces:
HandlerMapping, Ordered, ApplicationContextAware
Implementation of the
org.springframework.web.portlet.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>
- author:
William - G. Thompson, Jr.
- author:
John - A. Lewis
- since:
2.0 -
| Methods from org.springframework.web.portlet.handler.AbstractHandlerMapping: |
|---|
|
adaptInterceptor, extendInterceptors, getAdaptedInterceptors, getDefaultHandler, getHandler, getHandlerExecutionChain, getHandlerInternal, getOrder, initApplicationContext, initInterceptors, setApplyWebRequestInterceptorsToRenderPhaseOnly, setDefaultHandler, setInterceptors, setOrder |
| Method from org.springframework.web.portlet.handler.PortletModeHandlerMapping Detail: |
protected Object getLookupKey(PortletRequest request) throws Exception {
return request.getPortletMode();
}
Uses the current PortletMode as lookup key. |
public void initApplicationContext() throws BeansException {
super.initApplicationContext();
registerHandlers(this.portletModeMap);
}
Calls the registerHandlers method in addition
to the superclass's initialization. |
protected void registerHandlers(Map portletModeMap) throws BeansException {
if (CollectionUtils.isEmpty(portletModeMap)) {
logger.warn("Neither 'portletModeMap' nor 'mappings' set on PortletModeHandlerMapping");
}
else {
for (Iterator it = portletModeMap.entrySet().iterator(); it.hasNext();) {
Map.Entry entry = (Map.Entry) it.next();
String modeKey = (String) entry.getKey();
PortletMode mode = new PortletMode(modeKey);
Object handler = entry.getValue();
registerHandler(mode, handler);
}
}
}
Register all handlers specified in the Portlet mode map for the corresponding modes. |
public void setMappings(Properties mappings) {
this.portletModeMap.putAll(mappings);
}
Set PortletMode to handler bean name mappings from a Properties object. |
public void setPortletModeMap(Map portletModeMap) {
this.portletModeMap.putAll(portletModeMap);
}
Set a Map with PortletModes as keys and handler beans as values.
Convenient for population with bean references. |