java.lang.Objectorg.apache.struts2.dispatcher.mapper.DefaultActionMapper
org.apache.struts2.dispatcher.mapper.Restful2ActionMapper
All Implemented Interfaces:
ActionMapper
These two improvements allow a GET request for 'category/action/movie/Thrillers' to be mapped to the action name 'movie' with an id of 'Thrillers' with an extra parameter named 'category' with a value of 'action'. A single action mapping can then handle all CRUD operations using wildcards, e.g.
<action name="movie/*" className="app.MovieAction">
<param name="id">{0}</param>
...
</action>
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. This allows restful actions to not require wildcards.
The following URL's will invoke its methods:
GET: /movie/ => method="index"GET: /movie/Thrillers => method="view", id="Thrillers"GET: /movie/Thrillers!edit => method="edit", id="Thrillers"GET: /movie/new => method="editNew"POST: /movie/ => method="create"PUT: /movie/Thrillers => method="update", id="Thrillers"DELETE: /movie/Thrillers => method="remove", id="Thrillers"To simulate the HTTP methods PUT and DELETE, since they aren't supported by HTML, the HTTP parameter "__http_method" will be used.
The syntax and design for this feature was inspired by the ReST support in Ruby on Rails. See http://ryandaigle.com/articles/2006/08/01/whats-new-in-edge-rails-simply-restful-support-and-how-to-use-it
| Field Summary | ||
|---|---|---|
| protected static final Logger | LOG | |
| public static final String | HTTP_METHOD_PARAM | |
| Constructor: |
|---|
|
| Method from org.apache.struts2.dispatcher.mapper.Restful2ActionMapper Summary: |
|---|
| getIdParameterName, getMapping, isDelete, isGet, isPost, isPut, setIdParameterName |
| Methods from org.apache.struts2.dispatcher.mapper.DefaultActionMapper: |
|---|
| addParameterAction, dropExtension, dropExtension, getDefaultExtension, getMapping, getMappingFromActionName, getUri, getUriFromActionMapping, handleSpecialParameters, isSlashesInActionNames, parseActionName, parseNameAndNamespace, setAllowDynamicMethodCalls, setAlwaysSelectFullNamespace, setContainer, setExtensions, setSlashesInActionNames |
| Methods from java.lang.Object: |
|---|
| clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method from org.apache.struts2.dispatcher.mapper.Restful2ActionMapper Detail: |
|---|
|
|
|
|
|
|
|