public class RestActionMapper extends DefaultActionMapper
This mapper supports the following parameters:
struts.mapper.idParameterName
- If set, this value will be the name
of the parameter under which the id is stored. The id will then be removed
from the action name. Whether or not the method is specified, the mapper will
try to truncate the identifier from the url and store it as a parameter.
struts.mapper.indexMethodName
- The method name to call for a GET
request with no id parameter. Defaults to 'index'.
struts.mapper.getMethodName
- The method name to call for a GET
request with an id parameter. Defaults to 'show'.
struts.mapper.postMethodName
- The method name to call for a POST
request with no id parameter. Defaults to 'create'.
struts.mapper.putMethodName
- The method name to call for a PUT
request with an id parameter. Defaults to 'update'.
struts.mapper.deleteMethodName
- The method name to call for a DELETE
request with an id parameter. Defaults to 'destroy'.
struts.mapper.editMethodName
- The method name to call for a GET
request with an id parameter and the 'edit' view specified. Defaults to 'edit'.
struts.mapper.newMethodName
- The method name to call for a GET
request with no id parameter and the 'new' view specified. Defaults to 'editNew'.
The following URL's will invoke its methods:
GET: /movies => method="index"
GET: /movies/Thrillers => method="show", id="Thrillers"
GET: /movies/Thrillers;edit => method="edit", id="Thrillers"
GET: /movies/Thrillers/edit => method="edit", id="Thrillers"
GET: /movies/new => method="editNew"
POST: /movies => method="create"
PUT: /movies/Thrillers => method="update", id="Thrillers"
DELETE: /movies/Thrillers => method="destroy", id="Thrillers"
To simulate the HTTP methods PUT and DELETE, since they aren't supported by HTML, the HTTP parameter "_method" will be used.
Modifier and Type | Field and Description |
---|---|
static String |
HTTP_METHOD_PARAM |
protected static org.apache.logging.log4j.Logger |
LOG |
ACTION_PREFIX, allowedActionNames, allowedMethodNames, allowedNamespaceNames, allowSlashesInActionNames, alwaysSelectFullNamespace, container, defaultActionName, defaultMethodName, defaultNamespaceName, extensions, METHOD_PREFIX, prefixTrie
Constructor and Description |
---|
RestActionMapper() |
Modifier and Type | Method and Description |
---|---|
String |
getIdParameterName() |
ActionMapping |
getMapping(javax.servlet.http.HttpServletRequest request,
ConfigurationManager configManager) |
protected boolean |
isDelete(javax.servlet.http.HttpServletRequest request) |
protected boolean |
isExpectContinue(javax.servlet.http.HttpServletRequest request) |
protected boolean |
isGet(javax.servlet.http.HttpServletRequest request) |
protected boolean |
isOptions(javax.servlet.http.HttpServletRequest request) |
protected boolean |
isPost(javax.servlet.http.HttpServletRequest request) |
protected boolean |
isPut(javax.servlet.http.HttpServletRequest request) |
protected void |
parseNameAndNamespace(String uri,
ActionMapping mapping,
ConfigurationManager configManager)
Parses the name and namespace from the uri.
|
void |
setAllowDynamicMethodCalls(String allowDynamicMethodCalls) |
void |
setDeleteMethodName(String deleteMethodName) |
void |
setEditMethodName(String editMethodName) |
void |
setGetMethodName(String getMethodName) |
void |
setIdParameterName(String idParameterName) |
void |
setIndexMethodName(String indexMethodName) |
void |
setNewMethodName(String newMethodName) |
void |
setOptionsMethodName(String optionsMethodName) |
void |
setPostContinueMethodName(String postContinueMethodName) |
void |
setPostMethodName(String postMethodName) |
void |
setPutContinueMethodName(String putContinueMethodName) |
void |
setPutMethodName(String putMethodName) |
addParameterAction, cleanupActionName, cleanupMethodName, cleanupNamespaceName, dropExtension, getDefaultExtension, getMappingFromActionName, getUriFromActionMapping, handleDynamicMethod, handleExtension, handleName, handleNamespace, handleParams, handleSpecialParameters, isSlashesInActionNames, lookupExtension, parseActionName, setAllowActionCrossNamespaceAccess, setAllowActionPrefix, setAllowedActionNames, setAllowedMethodNames, setAllowedNamespaceNames, setAlwaysSelectFullNamespace, setContainer, setDefaultActionName, setDefaultMethodName, setDefaultNamespaceName, setExtensions, setSlashesInActionNames
protected static final org.apache.logging.log4j.Logger LOG
public static final String HTTP_METHOD_PARAM
public String getIdParameterName()
public void setIdParameterName(String idParameterName)
public void setIndexMethodName(String indexMethodName)
public void setGetMethodName(String getMethodName)
public void setPostMethodName(String postMethodName)
public void setEditMethodName(String editMethodName)
public void setNewMethodName(String newMethodName)
public void setDeleteMethodName(String deleteMethodName)
public void setPutMethodName(String putMethodName)
public void setOptionsMethodName(String optionsMethodName)
public void setPostContinueMethodName(String postContinueMethodName)
public void setPutContinueMethodName(String putContinueMethodName)
public void setAllowDynamicMethodCalls(String allowDynamicMethodCalls)
setAllowDynamicMethodCalls
in class DefaultActionMapper
public ActionMapping getMapping(javax.servlet.http.HttpServletRequest request, ConfigurationManager configManager)
getMapping
in interface ActionMapper
getMapping
in class DefaultActionMapper
protected void parseNameAndNamespace(String uri, ActionMapping mapping, ConfigurationManager configManager)
parseNameAndNamespace
in class DefaultActionMapper
uri
- The urimapping
- The action mapping to populateprotected boolean isGet(javax.servlet.http.HttpServletRequest request)
protected boolean isPost(javax.servlet.http.HttpServletRequest request)
protected boolean isPut(javax.servlet.http.HttpServletRequest request)
protected boolean isDelete(javax.servlet.http.HttpServletRequest request)
protected boolean isOptions(javax.servlet.http.HttpServletRequest request)
protected boolean isExpectContinue(javax.servlet.http.HttpServletRequest request)
Copyright © 2000–2020 Apache Software Foundation. All rights reserved.