Nuxeo provides a very powerful REST API but, as you might know, handling HTTP requests, headers, and server updates requires some heavy lifting. To make this heavy lifting easier, Nuxeo provides several REST clients for your preferred languages, such as:
- Nuxeo PHP Client
- Nuxeo Python Client
- Nuxeo .Net Client
- Nuxeo Dart Client
- Nuxeo Java Client
We started developing the Java client to work with a specific Nuxeo Server version. For instance,
1.x was for Nuxeo LTS 2015,
2.x was for Nuxeo LTS 2016 and we were planning to release a
3.x version for Nuxeo LTS 2017.
Here at Nuxeo, we always try to make our user's life easier. Sometimes we see that users delay important upgrades because the process could seem too long and tedious. Keeping that in mind, we reworked the whole Java client for the
3.x version with the goal of making the upgrade process quick and easy.
It's our pleasure to announce that the Nuxeo Java Client 3.0.0 works with all Nuxeo Servers starting from LTS 2015 and its first Release Candidate (RC1) is available now!
Along with this, we also introduced some great features:
- Test to check whether the connection to Nuxeo Server is successful when instantiating a
Document#contextParametersinto proper objects
- Uploading a blob from an
- Configuration manager endpoint
- Configuration isolation between managers
Let's take a quick look at how to use this client and some of the new features mentioned above:
Step 1: Create a client.
NuxeoClient client = new NuxeoClient.Builder().url("http://localhost:8080/nuxeo") .authentication("Administrator", "Administrator") .schemas("*") .connect();
At this step, we have a client that is able to handle requests to the Nuxeo Server.
Let’s create some documents now (we assume the client is connected to a fresh Nuxeo Server).
Document aFolder = Document.createWithName("aFolder", "Folder"); Document aFile = Document.createWithName("aFile", "File"); client.repository().createDocumentByPath("/", aFolder); client.repository().createDocumentByPath("/aFolder", aFile);
Step 2. Fetch
aFile document enriched with its breadcrumb.
aFile = client.repository().enrichersForDocument("breadcrumb").fetchDocumentByPath("/aFolder/aFile"); // get the breadcrumb from context parameters Documents breadcrumb = aFile.getContextParameter("breadcrumb"); aFolder = breadcrumb.getDocument(0); aFile = breadcrumb.getDocument(1);
Here we benefit from configuration isolation and context parameters deserialization. Each time we get a manager from the client, we get a new manager with its own configuration context initialized with the client's configuration. So in this example,
breadcrumb enricher will only be set for the
aFile fetch. Furthermore, as
breadcrumb is serialized as
documents by the Nuxeo Server, the client is able to deserialize it to
You can find more examples here.
Try it now and don't forget to give us your feedback. The final release will be made in October. Stay tuned!