velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Geir Magnusson Jr." <>
Subject Classpath Loader
Date Mon, 05 Mar 2001 04:00:37 GMT
As part of the ongoing loader fest, I added a simple, new loader called
ClasspathResourceLoader that will load templates from the classpath.

Now, as the classpath really is a yecchy idea, you may wonder why we
want this.

Well, it is remarkably easy to use - no altering your vel.props file
once you tell it to use this loader.

The real benefit, I think, is in 

1) Mixing your sources - you can use jars, zips and files all at the
same time.

2) More importantly, working with a v2.2 servlet runner (like Tomcat 3.2
or Catalina), you can simply jar your templates, and drop them into the
WEB-INF/lib directory, and not worry about any other configuration.  The
servlet runner will pick them up at start time and make them available
via the classloader.

I have tested with jars, zips and directories in Tomcat 3.2.1.

There is a bit more work and testing to do re proper behavior with
caching et al, and I haven't explicitly tried it with including static
content via #include(), but I can't imagine why it won't work.

I imagine this will be useful more for deployment than development, but
who knows...

I personally can't wait to switch to deploying template sets via jars to
my production sites that use Velocity....


Geir Magnusson Jr.                     
Developing for the web?  See

View raw message