ActionMapper has been edited by tm_jee (Nov 05, 2006).

Change summary:

added docs for RestfulActionMapper and Restful2ActionMapper

(View changes)

Content:
Content pulled from external source. Click
Content pulled from external source. Click
Content pulled from external source. Click
Content pulled from external source. Click
Content pulled from external source. Click
Content pulled from external source. Click
Content pulled from external source. Click
Content pulled from external source. Click
Content pulled from external source. Click
Content pulled from external source. Click
Content pulled from external source. Click struts.mapper.class.

Possible uses of the ActionMapper include defining your own, cleaner namespaces, such as URLs like /person/1, which would be similar to a request to /getPerson.action?personID=1 using the DefaultActionMapper.

RestfulActionMapper

Restful2ActionMapper

Content pulled from external source. Click
  • If the method is not specified (via '!' or 'method:' prefix), the method is "guessed" at using ReST-style conventions that examine the URL and the HTTP method.
  • Parameters are extracted from the action name, if parameter name/value pairs are specified using PARAM_NAME/PARAM_VALUE syntax.

    These two improvements allow a GET request for 'category/action/movie/Swingers' to be mapped to the action name 'movie' with an id of 'Swingers' 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>
    

    The following URL's will invoke its methods:

    • GET: /movie => method="index"
    • GET: /movie/Swingers => method="view", id="Swingers"
    • GET: /movie/Swingers!edit => method="edit", id="Swingers"
    • GET: /movie/new => method="editNew"
    • POST: /movie/Swingers => method="update"
    • PUT: /movie/ => method="create"
    • DELETE: /movie/Swingers => method="remove"

    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

  • CompositeActionMapper

    Next: Profiling

    Reply via email to