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


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.

Reply via email to