ModeShape's RESTful API was intended to be used by HTTP clients, so it's quite easy to write a simple client application to read and write repository content using the RESTful API. However, since our trusty web browser is indeed a simple HTTP client, we can use it to directly interact with the RESTful API. It might not be pretty, but it works beautifully.
Depending on whether you want to use the REST endpoint in the JBoss Application Server or another web server, there are 2 different options:
To embed the REST endpoint in your own application, you need to use the modeshape-web-jcr-rest-war artifact which comes pre-packaged with all the default dependencies (including ModeShape). The easiest way to use & customize this is to first add the artifact as a dependency in your project:
after which you need to overwrite (overlay) your own web.xml, repository configuration and optional additional dependencies. The former is the most important as it contains a reference towards your own custom repository configuration:
|Maven automatically overlays dependencies of type war, so all you need to do is make sure your project structure contains the correct paths: src/main/resource and src/main/webapp/WEB-INF/web.xml.|
See also our examples for such a configuration.
Once installed into Wildfly, the ModeShape Wildfly kit provides the RESTful API out-of-the-box, via a web application named modeshape-rest.war. This application is configured by default via the standalone-modeshape.xml server configuration file and allows access to all the repositories configured & deployed via Wildfly.
|By default, both web applications use Basic HTTP Authentication and require a role named connect to be present in the authenticated user's set of roles.|