Table of Contents
The point of Restful Objects is to provide our domain objects as RESTful resources so that they can be used by any other client application. These applications can be written in any language; so long as they can submit HTTP requests and can parse XHTML, they can interact with the resources provided by Restful Objects.
That said, if you are writing Java applications, then
Restful Objects provides an application library
(applib) to simplify the task. To reference this applib, add the following
to your Maven pom's <dependencies>
section:
<properties> <restfulobjects.version>1.0.0</restfulobjects.version> <!-- OR WHATEVER --> </properties> <dependencies> ... <dependency> <groupId>org.starobjects.restful</groupId> <artifactId>applib</artifactId> <version>${restfulobjects.version}</version> </dependency> ... </dependencies>
You then have a choice of approaches.
To get you started you might want to use the adapter,
AbstractRestfulClient
, available in the
Restful Objects' applib. This exposes some of the
HTTP methods, including GET and
POST, and serves up resources as
XML documents (using Elliot Rusty Harold's XOM library). There is also a
XomUtils
class, that provides some
pretty-printing support and a couple of other helper methods.
AbstractRestfulClient
is not particularly
comprehensive (at the time of writing it doesn't include support for
PUT or DELETE, for example). It
may well gain extra methods in future releases, however.