samarjit samanta created WW-4366:
------------------------------------
Summary: Action methods should accept arguments like @QueryParam, @FormParam,
@PathParam and specific request methods GET, PUT, POST etc
Key: WW-4366
URL: https://issues.apache.org/jira/browse/WW-4366
Project: Struts 2
Issue Type: New Feature
Components: Core Actions
Reporter: samarjit samanta
Struts2 action methods should accept arguments just like JAX-RS specs. Also certain method
types should be allowed only like GET, PUT, POST, DELTE.
Inspiration might be taken from struts-json plugin @SMDMthod but that is not a real action
method.
If there are multiple action methods in a Action class then it becomes less obvious which
variables are used for a particular action method.
Ex.
@ActionPath("/books/{id}")
public String showAction(@PathParam("id") String id,
@QueryParam("name") String name) {
...
return "success";
}
Also flexible return types as defined in JAX-RS would be great or atleast Result.json(myObject).includeActionErrors().includeActionMessages().done();
Result.string(myString).done();
Result.create("json").from(myObject).param("includeActionErrors,includeActionMessages").done();
Inspiration can be taken from struts2-json-plugin#SMDMethod and (struts2-freeroute-plugin)
[https://github.com/bastengao/struts2-freeroute]
--
This message was sent by Atlassian JIRA
(v6.2#6252)
|