REST POJOs are a Java 5 way of writing POJOs that implement RESTful services. They are an extension of AnDI to add some RESTful annotations.
See JRA
The core features are
- dependency inject HttpServletRequest and HttpServletResponse if required (which should be rare)
- dependency inject URI values or HTTP parameters or session based properties
- map methods to HTTP operations (GET, PUT, POST, DELETE)
- map parameters and return values to contents of HTTP requests which use a marshalling layer to serialize as
- JAXB 2
- SDO
- XStream
- use an explicit API such as W3C DOM, dom4j etc.
Example
@UriBinding(uri="/cheese/{id}") public class MyPOJO { @Resource ActionBeanContext context; // providers access to request/response et al via Stripes helper class @Get public Cheese load(Long id) { return cheese; // load by id } @Post public void insert(Cheese cheese) { ... } @Put public void update(Cheese cheese) { ... } @Delete public void delete(Long id) { ... } }