You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sling.apache.org by "Mike Müller (JIRA)" <ji...@apache.org> on 2010/12/01 16:36:16 UTC

[jira] Resolved: (SLING-1708) contrib/scripting/velocity is missing suitable resourceloader for the JCR

     [ https://issues.apache.org/jira/browse/SLING-1708?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Mike Müller resolved SLING-1708.
--------------------------------

    Resolution: Fixed

#parse and #include now work for Velocity with absolute paths. 
The implementation uses the resource resolver and includes therefore not only the JCR resources but all resources provided by a registered resource provider.
The enhance security one should define a special user to retrieve the resources from the resource resolver (velocityresourceloader.user).

commited a first shot in r1041052

> contrib/scripting/velocity is missing suitable resourceloader for the JCR
> -------------------------------------------------------------------------
>
>                 Key: SLING-1708
>                 URL: https://issues.apache.org/jira/browse/SLING-1708
>             Project: Sling
>          Issue Type: Bug
>          Components: Scripting
>         Environment: Felix 1.4, Sling 2.0.7, Apache Velocity 1.6.2 
>            Reporter: Olaf Otto
>            Assignee: Mike Müller
>             Fix For: Scripting Velocity 2.0.0
>
>   Original Estimate: 4h
>  Remaining Estimate: 4h
>
> Affects: Rev. 989119 of https://svn.apache.org/repos/asf/sling/trunk/contrib/scripting/velocity (2.0.0-SNAPSHOT) 
> The velocity resource manager (org.apache.velocity.runtime.resource.ResourceManagerImpl) has, by default, only an org.apache.velocity.runtime.resource.loader.FileResourceLoader instance. This resourceloader cannot load resources JCR resources as it attempts to access the filesystem.
> To reproduce, simply create a .vlt script and add an include directive:
> template1.vlt:
> #include("/path/to/template2.vlt")
> This will fail:
> org.apache.velocity.exception.ResourceNotFoundException: Unable to find resource '/path/to/template2.vlt'
> 	at org.apache.velocity.runtime.resource.ResourceManagerImpl.loadResource(ResourceManagerImpl.java:483)
> 	at org.apache.velocity.runtime.resource.ResourceManagerImpl.getResource(ResourceManagerImpl.java:354)
> 	at org.apache.velocity.runtime.RuntimeInstance.getContent(RuntimeInstance.java:1445)
> 	at org.apache.velocity.runtime.directive.Include.renderOutput(Include.java:229)
> 	at org.apache.velocity.runtime.directive.Include.render(Include.java:155)
> 	at org.apache.velocity.runtime.parser.node.ASTDirective.render(ASTDirective.java:175)
> 	at org.apache.velocity.runtime.parser.node.SimpleNode.render(SimpleNode.java:336)
> 	at org.apache.velocity.runtime.RuntimeInstance.render(RuntimeInstance.java:1277)
> 	at org.apache.velocity.runtime.RuntimeInstance.evaluate(RuntimeInstance.java:1216)
> A suitable resource loader should be provided to the VelocityEngine instance (perhaps in the VelocityTemplatesScriptEngine).

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.