public class PrefixBasedActionMapper extends DefaultActionMapper implements ActionMapper
A prefix based action mapper that is capable of delegating to other ActionMappers based on the request's prefix.
It is configured through struts.xml
For example, with the following entries in struts.properties
<constant name="struts.mapper.class" value="org.apache.struts2.dispatcher.mapper.PrefixBasedActionMapper"/> <constant name="struts.mapper.prefixMapping" value="/communities:pseudoRestful,/communityTags:pseudoRestful,/events:pseudoRestful,/mediaList:pseudoRestful,/users:pseudoRestful,/community:struts,/communityTag:struts,/event:struts,/media:struts,/user:struts,:struts"/>
When getMapping(HttpServletRequest, ConfigurationManager) or
getUriFromActionMapping(ActionMapping) is invoked,
PrefixBasedActionMapper will check each possible prefix (url prefix terminating just before a /) to find the most specific ActionMapper that returns a mapping when asked to map the request. If none are found, null is returned for both
getMapping(HttpServletRequest, ConfigurationManager) and
getUriFromActionMapping(ActionMapping) methods.
ActionMapper,
ActionMapping| Modifier and Type | Field and Description |
|---|---|
protected Map<String,ActionMapper> |
actionMappers |
protected Container |
container |
ACTION_PREFIX, allowDynamicMethodCalls, allowedActionNames, allowedMethodNames, allowSlashesInActionNames, alwaysSelectFullNamespace, defaultActionName, defaultMethodName, extensions, METHOD_PREFIX, prefixTrie| Constructor and Description |
|---|
PrefixBasedActionMapper() |
| Modifier and Type | Method and Description |
|---|---|
ActionMapping |
getMapping(javax.servlet.http.HttpServletRequest request,
ConfigurationManager configManager)
Expose the ActionMapping for the current request
|
String |
getUriFromActionMapping(ActionMapping mapping)
Convert an ActionMapping into a URI string
|
void |
setContainer(Container container) |
void |
setPrefixBasedActionMappers(String list) |
addParameterAction, cleanupActionName, cleanupMethodName, dropExtension, getDefaultExtension, getMappingFromActionName, handleDynamicMethod, handleExtension, handleName, handleNamespace, handleParams, handleSpecialParameters, isSlashesInActionNames, lookupExtension, parseActionName, parseNameAndNamespace, setAllowActionCrossNamespaceAccess, setAllowActionPrefix, setAllowDynamicMethodCalls, setAllowedActionNames, setAllowedMethodNames, setAlwaysSelectFullNamespace, setDefaultActionName, setDefaultMethodName, setExtensions, setSlashesInActionNamesclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetMappingFromActionNameprotected Container container
protected Map<String,ActionMapper> actionMappers
public void setContainer(Container container)
setContainer in class DefaultActionMapperpublic void setPrefixBasedActionMappers(String list)
public ActionMapping getMapping(javax.servlet.http.HttpServletRequest request, ConfigurationManager configManager)
ActionMappergetMapping in interface ActionMappergetMapping in class DefaultActionMapperrequest - The servlet requestconfigManager - The current configuration managerpublic String getUriFromActionMapping(ActionMapping mapping)
ActionMappergetUriFromActionMapping in interface ActionMappergetUriFromActionMapping in class DefaultActionMappermapping - The action mappingCopyright © 2000–2017 Apache Software Foundation. All rights reserved.