| ClasspathResourceLoader is a simple loader that will load
templates from the classpath.
Will load templates from from multiple instances of
and arbitrary combinations of :
- jar files
- zip files
- template directories (any directory containing templates)
This is a configuration-free loader, in that there are no
parameters to be specified in the configuration properties,
other than specifying this as the loader to use. For example
the following is all that the loader needs to be functional :
resource.loader = class
class.resource.loader.class =
org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader
To use, put your template directories, jars
and zip files into the classpath or other mechanisms that make
resources accessable to the classloader.
This makes deployment trivial for web applications running in
any Servlet 2.2 compliant servlet runner, such as Tomcat 3.2
and others.
For a Servlet Spec v2.2 servlet runner,
just drop the jars of template files into the WEB-INF/lib
directory of your webapp, and you won't have to worry about setting
template paths or altering them with the root of the webapp
before initializing.
I have also tried it with a WAR deployment, and that seemed to
work just fine.
author: Aki Nieminen author: Geir Magnusson Jr. version: $Id: ClasspathResourceLoader.java 471259 2006-11-04 20:26:57Z henning $ |