Quantcast
Channel: CQ 5
Viewing all articles
Browse latest Browse all 35

[CRX] Accessing CRX Remotely using Jcr Remoting Based On Webdav (DavEx)

$
0
0
Goal: To access CRX remotely in a client java program, JCR Remoting (DavEx). This post is on using JCR Remoting (aka WebDav remoting, DavEx).

Solution:
<dependency>
<groupId>org.apache.jackrabbit</groupId>
<artifactId>jackrabbit-jcr2dav</artifactId>
<version>2.13.4</version>
<scope>test</scope>
</dependency>

@Testpublic void testJson() throws RepositoryException, JSONException {
String REPO = "http://localhost:4502/crx/server";String WORKSPACE = "crx.default";
Repository repository = JcrUtils.getRepository(REPO);
Session session = repository.login(new SimpleCredentials("admin",
"admin".toCharArray()), WORKSPACE);
// Getting a particular nodeNode root = session.getRootNode();
Node subContent = root.getNode("apps/geometrixx-gov/components/logo");

// Iterating over the nodes and printing their names
StringWriter stringWriter = new StringWriter();
JsonItemWriter jsonWriter = new JsonItemWriter(null);
jsonWriter.dump(subContent, stringWriter, -1, true);
String json = stringWriter.toString();

System.out.println(json);}

More documentation:
http://wiki.apache.org/jackrabbit/RemoteAccess
https://docs.adobe.com/docs/en/crx/2-3/developing/accessing_the_crx.html

Viewing all articles
Browse latest Browse all 35

Trending Articles