You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by Magnus Kvalheim <bm...@inaphone.com> on 2005/11/23 11:33:09 UTC
Write a custom resourceloader
Hi all,
I have tried to write a custom resourceloader on order to be able to
load templates from an alternate source.
I am using velocity-tools 1.2
I have extended the
org.apache.velocity.runtime.resource.loader.ResourceLoader class and
registered the resource loader in the velocity.properties file like this.
---------
resource.loader = custom
custom.resource.loader.description = A custom resource loader
custom.resource.loader.class = package.CustomResourceLoader
-------
The resource loader is indeed being loaded - as the init function is
called when the project is deployed to the web server. It also calls the
getResourceStream with the "/WEB-INF/VM_global_library.vm" as parameter,
but I guess the ResourceManagerImpl is the cause of this.
The getResourceStream for my custom class is however NEVER called when I
request a template.
getTemplate("templateFromCustomSource.vm");
Have I missed something?
Shouldn't velocity now look for templates in both WebAppLoader and
CustomResourceLoader?
thanks
Magnus
---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org