Implementing REST style protocols, quick reminders
Use generic REST Protocols
Re-use those protocols wherever possible, they are well tested, accepted and have extensive tooling available...
Generic format for lists of metadata
For writing back changes to resources. The Apache Abdera project provides a good Java library for it.
OpenSearch is a collection of simple formats for the sharing of search results. It is supported out of the box by a large amount of software, including most web browsers and most search widgets.
Quick protocol design reminders
- Navigable interface rather than template generators
- Whenever possible, client code should NOT have to know how to generate URLs. They should be directly provided, in full, by the server.
- HATEOAS: Hypermedia as the engine of application state
- The client is responsible for maintaining application state, the server for making sure only valid transitions are allowed
- PUT, DELETE must be idempotent
- GET may not have side effects
For a bit more details, see the article RESTful Web Services Development Checklist (pdf)
Java libraries to help consume or serve REST interfaces
- Project Jersey Implantation de JAX-RS (JSR-311) pour l'abstraction de la couche REST en Java
- RESTEasy Framework équivalent du côté JBoss
Articles sur Jax-rs avec spring