ModeShape/modeshape — pull request #474 by hchiorean (2012-08-16 08:04:03+00:00)
Title: Mode 1583 - Added a new version of ModeShape's REST service

Design and Implementation
---------------------------------------
There were several challenges while working on this, one of which was making sure the existing service remains unchanged, functionality wise. The other was leveraging some the features that RESTEasy offers as far a content representation, streaming, multi-part requests etc. goes. To be able to have all these, some parts of the old API were deprecated (but left unchanged) and other parts were extended and used in conjunction with a POJO-based REST model, MessageBodyWriters and Forms.

The existing unit tests had to be rewritten (code-wise, not semantically) so they can be extended.

REST updates
---------------------
The old service's URL was prefixed with /v1, while the new service uses the default url. The old service's requests remain unchanged. The existing REST client (modeshape-rest-client) uses the old service.

* the methods that existed in the old service (get repositories, workspaces, get/create/delete/update items, queries) are present in similar fashion in the new service, but the format of the response has changed in some cases: a lot of URLs (absolute urls) to resources are returned; for nodes the "properties" section is gone and the properties are returned directly in the object's body. Binary properties are always returned as URLs which can then be used to stream the actual binary content.
* MODE-887 - URLs are returned in query results
* MODE-1541 - for working with binary values, a new set of methods (at the /binary path) were added. Those methods get/create/update binary values using streaming. Also, there is a method which supports the POST of a binary file via a HTML form, as a multipart/form request.
* for working with node types, a new set of methods (at the /nodetypes path) were added. Those methods allow retrieving a node type from the repository and uploading a CND file. Also, there is a method which supports the POST of a CND file via a HTML form, as a multipart/form request
* for working with batch of items (nodes/properties), 3 new methods were added which perform bulk creation/update/deletion of items, expecting a JSON object/array in the request.