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:
More documentation:
http://wiki.apache.org/jackrabbit/RemoteAccess
https://docs.adobe.com/docs/en/crx/2-3/developing/accessing_the_crx.html
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 node Node 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
Nhận xét
Đăng nhận xét