简体   繁体   中英

Java JCR/Adobe AEM: How do I access the node directly without using queries?

as above. I've looked at "getNode" (part of javax.jcr.node) and it requires a relative path. I'm hoping there's a function that I haven't seen yet that accepts an absulate path.

Code example:

Node node = Node.getNodeByAbsulotePath("/content/my-folder-here/my-node-here");

You need a javax.jcr.Session object, to access the repository. It has the wanted session.getNode(absPath) method.

Every Node-object has a backlink to its session, therefore you can either traverse forward the node-structure via node.getNode(relPath) or just get the session via node.getSession() .

see:

https://docs.adobe.com/content/docs/en/spec/jsr170/javadocs/jcr-2.0/javax/jcr/Session.html#getNode(java.lang.String)

or the JackrabbitSession:

https://jackrabbit.apache.org/api/2.12/org/apache/jackrabbit/api/JackrabbitSession.html

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM