I have changed the rest action mapper class to apply Ruby Style .
there is draft, post here to find a better way to build RESTful app with
struts2

Rest style action mapper

Using with struts2-rest-plugin, replace the orginal RestActionMapper class.

With url patterns below to support CRUD operations.

    * get http://localhost/app/namespace/controller index
    * get http://localhost/app/namespace/controller/id show
    * get http://localhost/app/namespace/controller/new new
    * get http://localhost/app/namespace/controller/id;edit edit
    * post http://localhost/app/namespace/controller create
    * put http://localhost/app/namespace/controller/id update
    * delete http://localhost/app/namespace/controller/id delete

Besides, you could use Parameters and Parameter annotations with Regular
Expression to support custom url pattern and Request Parameter Mapping.
@Parameters( { @Parameter(pattern = "page/(\\w+)", property = "page") })
public class TopicsController(){ }

thus,

  get http://localhost/namespace/controller/page/1
 

will call controller's index() method with parameter {page=1} 


http://www.nabble.com/file/p19263471/RestActionMapper.java
RestActionMapper.java 
http://www.nabble.com/file/p19263471/TopicsController.java
TopicsController.java 
-- 
View this message in context: 
http://www.nabble.com/Some-Idea-On-REST-mapping-tp19263471p19263471.html
Sent from the Struts - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to