The Nuxeo Java Client is a Java client library for Nuxeo REST API.
It is compatible with all Nuxeo versions as of LTS 2015.
Getting Started
Follow this tutorial to have a running Nuxeo instance on your local machine.
Installation
To use nuxeo-java-client, you can download it from our Nexus: Nuxeo Client Library 3.2.0.
If you use Maven, you need to have nuxeo-java-client as dependency:
<dependency>
<groupId>org.nuxeo.client</groupId>
<artifactId>nuxeo-java-client</artifactId>
<version>3.2.0</version>
</dependency>
<repository>
<id>public-releases</id>
<url>http://maven.nuxeo.com/nexus/content/repositories/public-releases/</url>
</repository>
<repository>
<id>public-snapshots</id>
<url>http://maven.nuxeo.com/nexus/content/repositories/public-snapshots/</url>
</repository>
Client Creation
Nuxeo Java Client is created with help of its Builder
. Once every options are submitted, last step is to build the client and test the connection to Nuxeo Server:
NuxeoClient client = new NuxeoClient.Builder()
.url("http://localhost:8080/nuxeo")
.authentication("Administrator", "Administrator")
.schemas("*") // fetch all document schemas
.connect();
Client is now ready to execute requests to Nuxeo Server. After its creation, it will contain the current Nuxeo user and the Nuxeo Server version.
More documentation about client options.
Fetch Your First Document
Below is how we can retrieve default domain from a stock Nuxeo Server:
Document domain = client.repository().fetchDocumentByPath("/default-domain");
String title = domain.getPropertyValue("dc:title"); // should be equal to "Domain"