类 ParameterHandlerMapping
- java.lang.Object
- org.springframework.context.support.ApplicationObjectSupport
- org.springframework.web.portlet.handler.AbstractHandlerMapping
- org.springframework.web.portlet.handler.AbstractMapBasedHandlerMapping<String>
- org.springframework.web.portlet.handler.ParameterHandlerMapping
- 所有已实现的接口:
Aware
,ApplicationContextAware
,Ordered
,HandlerMapping
public class ParameterHandlerMapping extends AbstractMapBasedHandlerMapping<String>
Implementation of theHandlerMapping
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!- 从以下版本开始:
- 2.0
- 作者:
- John A. Lewis, Juergen Hoeller
- 另请参阅:
ParameterMappingInterceptor
嵌套类概要
从类继承的嵌套类/接口 org.springframework.web.portlet.handler.AbstractMapBasedHandlerMapping
AbstractMapBasedHandlerMapping.PortletRequestMappingPredicate
字段概要
字段 修饰符和类型 字段 说明 static String
DEFAULT_PARAMETER_NAME
Default request parameter name to use for mapping to handlers: "action".从类继承的字段 org.springframework.context.support.ApplicationObjectSupport
logger
从接口继承的字段 org.springframework.core.Ordered
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE
构造器概要
构造器 构造器 说明 ParameterHandlerMapping()
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 protected String
getLookupKey(PortletRequest request)
Uses the value of the specified parameter as lookup key.void
initApplicationContext()
Calls theregisterHandlers
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.从类继承的方法 org.springframework.web.portlet.handler.AbstractMapBasedHandlerMapping
getHandlerInternal, registerHandler, registerHandler, registerHandlers, setLazyInitHandlers
从类继承的方法 org.springframework.web.portlet.handler.AbstractHandlerMapping
adaptInterceptor, extendInterceptors, getAdaptedInterceptors, getDefaultHandler, getHandler, getHandlerExecutionChain, getOrder, initInterceptors, setApplyWebRequestInterceptorsToRenderPhaseOnly, setDefaultHandler, setInterceptors, setOrder
从类继承的方法 org.springframework.context.support.ApplicationObjectSupport
getApplicationContext, getMessageSourceAccessor, initApplicationContext, isContextRequired, requiredContextClass, setApplicationContext
字段详细资料
DEFAULT_PARAMETER_NAME
public static final String DEFAULT_PARAMETER_NAME
Default request parameter name to use for mapping to handlers: "action".- 另请参阅:
- 常量字段值
构造器详细资料
ParameterHandlerMapping
public ParameterHandlerMapping()
方法详细资料
setParameterName
public void setParameterName(String parameterName)
Set the name of the parameter used for mapping to handlers.Default is "action".
setParameterMap
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.- 参数:
parameterMap
- map with parameters as keys and beans as values
initApplicationContext
public void initApplicationContext() throws BeansException
Calls theregisterHandlers
method in addition to the superclass's initialization.- 覆盖:
initApplicationContext
在类中AbstractHandlerMapping
- 抛出:
ApplicationContextException
- in case of initialization errorsBeansException
- if thrown by ApplicationContext methods- 另请参阅:
AbstractMapBasedHandlerMapping.registerHandlers(java.util.Map<K, ?>)
getLookupKey
protected String getLookupKey(PortletRequest request) throws Exception
Uses the value of the specified parameter as lookup key.- 指定者:
getLookupKey
在类中AbstractMapBasedHandlerMapping<String>
- 参数:
request
- current portlet request- 返回:
- the lookup key (never
null
) - 抛出:
Exception
- if key computation failed- 另请参阅:
setParameterName(java.lang.String)