|
The Spring Framework | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
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.ParameterHandlerMapping
public class ParameterHandlerMapping
Implementation of the HandlerMapping interface 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!
ParameterMappingInterceptor
Field Summary | |
---|---|
static String |
DEFAULT_PARAMETER_NAME
Default request parameter name to use for mapping to handlers: "action". |
Fields inherited from class org.springframework.context.support.ApplicationObjectSupport |
---|
logger |
Fields inherited from interface org.springframework.core.Ordered |
---|
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE |
Constructor Summary | |
---|---|
ParameterHandlerMapping()
|
Method Summary | |
---|---|
protected Object |
getLookupKey(PortletRequest request)
Uses the value of the specified parameter as lookup key. |
void |
initApplicationContext()
Calls the registerHandlers method in addition
to the superclass's initialization. |
protected void |
registerHandlers(Map parameterMap)
Register all handlers specified in the Portlet mode map for the corresponding modes. |
void |
setParameterMap(Map 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. |
Methods inherited from class org.springframework.web.portlet.handler.AbstractMapBasedHandlerMapping |
---|
getHandlerInternal, registerHandler, setLazyInitHandlers |
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 org.springframework.context.support.ApplicationObjectSupport |
---|
getApplicationContext, getMessageSourceAccessor, isContextRequired, requiredContextClass, setApplicationContext |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String DEFAULT_PARAMETER_NAME
Constructor Detail |
---|
public ParameterHandlerMapping()
Method Detail |
---|
public void setParameterName(String parameterName)
Default is "action".
public void setParameterMap(Map parameterMap)
parameterMap
- map with parameters as keys and beans as valuespublic void initApplicationContext() throws BeansException
registerHandlers
method in addition
to the superclass's initialization.
initApplicationContext
in class AbstractHandlerMapping
ApplicationContextException
- in case of initialization errors
BeansException
- if thrown by ApplicationContext methodsregisterHandlers(java.util.Map)
protected void registerHandlers(Map parameterMap) throws BeansException
registerHandlers
in class AbstractMapBasedHandlerMapping
parameterMap
- Map with parameter names as keys and handler beans or bean names as values
BeansException
- if the handler couldn't be registeredprotected Object getLookupKey(PortletRequest request) throws Exception
getLookupKey
in class AbstractMapBasedHandlerMapping
request
- current portlet request
null
)
Exception
- if key computation failedsetParameterName(java.lang.String)
|
The Spring Framework | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |