[ https://issues.apache.org/jira/browse/SLING-8562?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16882745#comment-16882745 ]
Ben Fortuna commented on SLING-8562: ------------------------------------ [~jsedding] apologies, I should have said script not "successfully" resolved. :) I've just written a quick test to demonstrate each of the above suggestions: {code:java} Testing sling scripting (ESP) with FS resource: {properties} = [org.mozilla.javascript.EcmaError: ReferenceError: "properties" is not defined.] {resource} = [/content/innersource/index] {resource.valueMap} = [undefined] {currentNode} = [/content/innersource/index] {currentNode.name} = [java.lang.UnsupportedOperationException at org.apache.sling.fsprovider.internal.mapper.jcr.FsNode.getNodes(FsNode.java:517)] {currentNode.path} = [java.lang.UnsupportedOperationException at org.apache.sling.fsprovider.internal.mapper.jcr.FsNode.getNodes(FsNode.java:517)]{code} It appears that "properties" is not defined, and "resource" is defined but doesn't have a "valueMap" property. For "currentNode" it is also defined, but any property access seems to resolve to the same FsNode.getNodes(String) method, which is not implemented. I did have a look at the code and it appears that for currentNode.name or currentNode.path it SHOULD be calling a different method that is registered with Rhino via the "jsFunction_" method prefix, but I suspect this isn't working anymore so it falls back on the getNodes(String) method. > Unable to resolve ESP scripts loaded from Filesystem Resource Provider > ---------------------------------------------------------------------- > > Key: SLING-8562 > URL: https://issues.apache.org/jira/browse/SLING-8562 > Project: Sling > Issue Type: Bug > Affects Versions: Scripting Core 2.0.46, File System Resource Provider > 2.1.16 > Reporter: Ben Fortuna > Priority: Major > > A simple test fails when trying to load a resource via Sling Filesystem > Resource Provider. > /content/sample/index.json: > {code:java} > { > "sling:resourceType": "sample/page/index", > "jcr:primaryType": "nt:unstructured", > "title": "Sample App" > }{code} > > /apps/sample/page/index/html.esp: > {code:java} > <html> > <head><title>${currentNode.title}</title></head> > <body></body> > </html>{code} > > When both content and app are mounted via Filesystem Resource Provider config > the following error results: > {code:java} > Internal Server Error (500) > Exception: > java.lang.UnsupportedOperationException > at > org.apache.sling.fsprovider.internal.mapper.jcr.FsNode.getNodes(FsNode.java:517) > at > org.apache.sling.scripting.javascript.wrapper.ScriptableNode.get(ScriptableNode.java:319) > ...{code} > > Basically the javascript renderer tries to call `Node.getNodes(pattern)` to > resolve the property `currentNode.title` but Filesystem Resource Provider > doesnt support this method. > -- This message was sent by Atlassian JIRA (v7.6.14#76016)