...
Wiki Markup | ||
---|---|---|
{snippet:url=struts2/apps/rest-showcase/src/main/webapp/WEB-INF/web.xml|id=filter|lang=xml} | ||
Code Block | ||
|
To
...
set
...
other
...
Struts
...
properties,
...
add
...
other
...
init-params.
...
For
...
example
...
to
...
set
...
devMode
...
to
...
true, add:
Code Block | ||
---|---|---|
| ||
add {code> <!-- ... --> <init-param> <param-name>struts.devMode</param-name> <param-value>true</param-value> </init-param> </filter> |
Next, create Java objects ending in "Resource" in the configured package. The "Resource" suffix is used to distinguish Rest action resources from regular Struts 2 actions, although it is completely optional and they are functionally the same. Now, add in methods to handle the various requests. For example, the following resource action will support /orders/34
GET and PUT requests:
...