[ https://issues.apache.org/jira/browse/SLING-12300?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17839067#comment-17839067 ]
Joerg Hoh edited comment on SLING-12300 at 4/19/24 5:25 PM: ------------------------------------------------------------ I am not that happy with this magic string: * It does not feel sling-ish (I would expect a ResourceProvider for it) * It might break code, which relies on {noformat} String jcrIdPath="/jcr:id/12345678"; Resoure r = resourceResolver.getResource(jcrIdPath); assertEquals(fullPath,r.getPath()); {noformat} (although such code might break in other cases already today, when using aliases and vanity paths) * is it possible to do a request to [http://localhost:8080/jcr:id/]<id>.html and get the result rendered? Do we want this to happen? * Right now it's not possible to turn off this behavior. was (Author: joerghoh): I am not that happy with this magic string: * It does not feel sling-ish (I would expect a ResourceProvider for it) * I might break code, which relies on {noformat} String jcrIdPath="/jcr:id/12345678"; Resoure r = resourceResolver.getResource(jcrIdPath); assertEquals(fullPath,r.getPath()); {noformat} (although such code might break in other cases already today, when using aliases and vanity paths) * is it possible to do a request to http://localhost:8080/jcr:id/<id>.html and get the result rendered? Do we want this to happen? * Right now it's not possible to turn off this behavior. > Provide a way to retrieve a JCR backed resource by its node identifier > ---------------------------------------------------------------------- > > Key: SLING-12300 > URL: https://issues.apache.org/jira/browse/SLING-12300 > Project: Sling > Issue Type: New Feature > Components: JCR > Reporter: Radu Cotescu > Assignee: Radu Cotescu > Priority: Major > Fix For: JCR Resource 3.3.0 > > > Since all {{javax.jcr.Nodes}} have an identifier [0], a useful feature would > be {{Resource}} retrieval by node id, which could be its {{jcr:uuid}} > property for referenceable nodes or the path. In systems that would like to > use UUID addressing, this would reduce the need for executing JCR queries for > resource retrieval and would avoid double-reads via the JCR and then Sling > API to obtain the resource. > In order to provide a unified behaviour, paths starting with the {{/jcr:id/}} > prefix should use the resource retrieval by node identifier. > [0] - > https://javadoc.io/static/javax.jcr/jcr/2.0/javax/jcr/Node.html#getIdentifier() -- This message was sent by Atlassian Jira (v8.20.10#820010)