类 PortletModeParameterHandlerMapping

  • 所有已实现的接口:
    Aware, ApplicationContextAware, Ordered, HandlerMapping

    public class PortletModeParameterHandlerMapping
    extends AbstractMapBasedHandlerMapping<org.springframework.web.portlet.handler.PortletModeParameterLookupKey>
    Implementation of the HandlerMapping interface to map from the current PortletMode and a request parameter to request handler beans. The mapping consists of two levels: first the PortletMode and then the parameter value. In order to be mapped, both elements must match the mapping definition.

    This is a combination of the methods used in PortletModeHandlerMapping and ParameterHandlerMapping. Unlike those two classes, this mapping cannot be initialized with properties since it requires a two-level map.

    The default name of the parameter is "action", but can be changed using setParameterName().

    By default, the same parameter value may not be used in two different portlet modes. This is so that if the portal itself changes the portlet mode, the request will no longer be valid in the mapping. This behavior can be changed with setAllowDupParameters().

    The bean configuration for this mapping will look somthing like this:

     <bean id="portletModeParameterHandlerMapping" class="org.springframework.web.portlet.handler.PortletModeParameterHandlerMapping">
       <property name="portletModeParameterMap">
         <map>
           <entry key="view"> <!-- portlet mode: view -->
             <map>
               <entry key="add"><ref bean="addItemHandler"/></entry>
               <entry key="edit"><ref bean="editItemHandler"/></entry>
               <entry key="delete"><ref bean="deleteItemHandler"/></entry>
             </map>
           </entry>
           <entry key="edit"> <!-- portlet mode: edit -->
             <map>
               <entry key="prefs"><ref bean="preferencesHandler"/></entry>
               <entry key="resetPrefs"><ref bean="resetPreferencesHandler"/></entry>
             </map>
           </entry>
         </map>
       </property>
     </bean>

    This mapping can be chained ahead of a PortletModeHandlerMapping, which can then provide defaults for each mode and an overall default as well.

    Thanks to Rainer Schmitz and Yujin Kim for suggesting this mapping strategy!

    从以下版本开始:
    2.0
    作者:
    John A. Lewis, Juergen Hoeller
    另请参阅:
    ParameterMappingInterceptor