public class

ParameterHandlerMapping

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

Class Overview

Implementation of the HandlerMapping to map from a request parameter to request handler beans.

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

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

 <bean id="parameterHandlerMapping" class="org.springframework.web.portlet.handler.ParameterHandlerMapping">
   <property name="parameterMap">
     <map>
 	     <entry key="add"><ref bean="addItemHandler"/></entry>
       <entry key="edit"><ref bean="editItemHandler"/></entry>
       <entry key="delete"><ref bean="deleteItemHandler"/></entry>
     </map>
   </property>
 </bean>
Thanks to Rainer Schmitz for suggesting this mapping strategy!

Summary

Constants
String DEFAULT_PARAMETER_NAME Default request parameter name to use for mapping to handlers: "action".
[Expand]
Inherited Constants
From interface org.springframework.core.Ordered
[Expand]
Inherited Fields
From class org.springframework.context.support.ApplicationObjectSupport
Public Constructors
ParameterHandlerMapping()
Public Methods
void initApplicationContext()
Calls the registerHandlers method in addition to the superclass's initialization.
void setParameterMap(Map<String, ?> parameterMap)
Set a Map with parameters as keys and handler beans or bean names as values.
void setParameterName(String parameterName)
Set the name of the parameter used for mapping to handlers.
Protected Methods
String getLookupKey(PortletRequest request)
Uses the value of the specified parameter as lookup key.
[Expand]
Inherited Methods
From class org.springframework.web.portlet.handler.AbstractMapBasedHandlerMapping
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

Constants

public static final String DEFAULT_PARAMETER_NAME

Default request parameter name to use for mapping to handlers: "action".

Constant Value: "action"

Public Constructors

public ParameterHandlerMapping ()

Public Methods

public void initApplicationContext ()

Calls the registerHandlers method in addition to the superclass's initialization.

public void setParameterMap (Map<String, ?> parameterMap)

Set a Map with parameters as keys and handler beans or bean names as values. Convenient for population with bean references.

Parameters
parameterMap map with parameters as keys and beans as values

public void setParameterName (String parameterName)

Set the name of the parameter used for mapping to handlers.

Default is "action".

Protected Methods

protected String getLookupKey (PortletRequest request)

Uses the value of the specified parameter as lookup key.

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