Apache Struts 2 Plugin Registry > Home > REST Plugin > RESTful CRUD for HTML methods
#editReport()

Heuristic Method Matching

Action SQL REST Verb HTML Method URI Invokes Parameters Notes
Create Insert PUT POST /my-resource MyResource.create ...  
Read Select GET GET /my-resource/-id MyResource.read ... aka FindbyId
Update Update POST POST /my-resource/-id MyResource.update id="id", ... with one or more POST attributes
Delete Delete DELETE POST /my-resource/-id MyResource.delete id="id" with zero POST attributes (or single delete attribute )
Welcome Describe n/a GET /my-resource MyResource.index ...  
Input for Create n/a n/a GET /my-resource-input MyResource.input ...  
Input for Update n/a n/a GET /my-resource-input/-id MyResource.input id="id", ...  
Other State Read n/a n/a GET /my-resource-other(/-id) MyResource.other ...  
Other State Change n/a n/a POST /my-resource-other(/-id) MyResource.other ...  

Key

"..." indicates that there may be other attributes passed through the POST or GET request
"-id" is the action.name.separator followed by the value of the primary identifier for the resource (/album/-Thriller)

Not shown is the possibility that other attribute name/value pairs may follow the /-id/ field or a blank /-/ field.

  • POST /inventory/album/-/id/Thriller/artist/Michael Jackson/genre/pop
  • GET /inventory/album/-Thriller
  • POST /inventory/album/-Thriller/released/1984-12-01
  • POST /inventory/album/-Thriller

Note that whether PUT maps to create or update varies by source.

Heuristic Result Matching

  1. (on "success") my-resource-$method (e.g., -create, -read, -update, -delete, -index, -input, -other)
  2. my-resource-$result-code (e.g., "success", "cancel", "input", "error")
  3. $result-code
  4. my-resource

An "extension" to result matching would be to map default result-type to suffixes added to result codes. For example, a result code like "success.ftl" would utilize the FreeMarker result.

Heuristic Action Matching

  1. MyResource
  2. MyResourceAction
  3. My.resource
  4. MyAction.resource
  5. my-resource/Index
  6. or the package default (ActionSupport)

Settings

  • base.action.packages (action)
  • base.result.location (/WEB-INF/result)
  • create.method (create), read.method (read), update.method (update), delete.method (delete), welcome.method (index)
  • action.name.separator (-)

Resources