velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Tim Colson" <tcol...@cisco.com>
Subject Using both Jar and Webapp resource paths
Date Tue, 07 Sep 2004 23:41:51 GMT
Nathan said:
> if there's ... no resource loader specified in the
> velocity.properties file, then the WebappLoader is used. 
> otherwise, if resource loader(s)
> is/are specified in whatever properties file the user tells 
> the VVS to use, the VVS will use that/those resource loader(s).

I'm trying to setup a dev environment where include paths can stay the same
for local files, as well as later when I bundle up the 'common'
layout/macros into a JAR. That jar will be shared among other projects. (Try
THAT, JSP! <grin>)

I have dual loaders working for VelocityViewServlet:

#---------------------------------------------------------------------------
-
# RESOURCE loaders
#---------------------------------------------------------------------------
-
resource.loader = class, webapp
#
# ClasspathResourceLoader
class.resource.loader.description = Velocity Classpath Resource Loader
class.resource.loader.class =
org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader
# WebappResourceLoader
webapp.resource.loader.description = Velocity Webapp Resource Loader
webapp.resource.loader.class=org.apache.velocity.tools.view.servlet.WebappLo
ader

To make paths work in either case, I added template directories into the
classpath. Works great to resolve "common/footer.vm" in
WEB-INF/templates/vm/common/footer.vm or inside a bundled common-ui.jar. I
looked at the WebappLoader and it seems the same functionality can be setup
in the config with webapp.resource.loader.path. 

Spiffy.  In fact, it works so well, I'm kind of spoiled now. <grin>

So just wanted to say my hats off to Geir/Nathan/Gabe/Marino and everyone
else for continuing to surprise me with code that Just Works. :-)

Cheers,
Timo











---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org


Mime
View raw message