You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by Will Glass-Husain <wg...@forio.com> on 2004/06/29 02:16:17 UTC

classpath resource loader reload issue

Hi,

Been a while since I asked a question instead of answered one, but I'm using
the ClasspathResourceLoader for the first time (to generate emails from a
webapp).  I've copied my VM files to WEB-INF/classes.  The VelocityEngine
reads the VM files fine, but if I change the VM files it doesn't pick up on
the changes until I close the VelocityEngine and create a new one.

This probably doesn't matter for production, but is darn frustrating for
development.  I keep having to shutdown Tomcat and restart it in order to
see the impact of changes to the templates.   (I store the VelocityEngine as
an application attribute).  My impression is that with caching off, I should
see changes instantly (like I do with the FileResourceLoader).

I thought I'd use the ClassPathResourceLoader for ease of revision &
deployment, but I've sunk more time into this than it would have taken to
whip up a relative path FileResourceLoader.

Anyone else hit an issue like this?

VelocityEngine ve = new VelocityEngine();
ve.setProperty("resource.loader","class");
ve.setProperty("class.resource.loader.class","org.apache.velocity.runtime.re
source.loader.ClasspathResourceLoader");
ve.setProperty("class.resource.loader.cache","false");
ve.setProperty(RuntimeConstants.RUNTIME_LOG_LOGSYSTEM_CLASS,"org.apache.velo
city.runtime.log.SimpleLog4JLogSystem");
ve.setProperty("runtime.log.logsystem.log4j.category",
"com.forio.velocity");
ve.init();


WILL


_______________________________________
Forio Business Simulations

Will Glass-Husain
wglass@forio.com
www.forio.com


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


RE: classpath resource loader reload issue

Posted by Mike Curwen <g_...@globallyboundless.com>.
I do email from webapps as well, and I've used the FileResourceLoader
with something like:
p.setProperty("file.resource.loader.path",
app.getRealPath("/WEB-INF/templates"));


> -----Original Message-----
> From: Will Glass-Husain [mailto:wglass@forio.com] 
> Sent: Monday, June 28, 2004 7:16 PM
> To: Velocity Users List
> Subject: classpath resource loader reload issue
> 
> 
> Hi,
> 
> Been a while since I asked a question instead of answered 
> one, but I'm using the ClasspathResourceLoader for the first 
> time (to generate emails from a webapp).  I've copied my VM 
> files to WEB-INF/classes.  The VelocityEngine reads the VM 
> files fine, but if I change the VM files it doesn't pick up 
> on the changes until I close the VelocityEngine and create a new one.
> 
> This probably doesn't matter for production, but is darn 
> frustrating for development.  I keep having to shutdown 
> Tomcat and restart it in order to
> see the impact of changes to the templates.   (I store the 
> VelocityEngine as
> an application attribute).  My impression is that with 
> caching off, I should see changes instantly (like I do with 
> the FileResourceLoader).
> 
> I thought I'd use the ClassPathResourceLoader for ease of 
> revision & deployment, but I've sunk more time into this than 
> it would have taken to whip up a relative path FileResourceLoader.
> 
> Anyone else hit an issue like this?
> 
> VelocityEngine ve = new VelocityEngine(); 
> ve.setProperty("resource.loader","class");
> ve.setProperty("class.resource.loader.class","org.apache.veloc
> ity.runtime.re
> source.loader.ClasspathResourceLoader");
> ve.setProperty("class.resource.loader.cache","false");
> ve.setProperty(RuntimeConstants.RUNTIME_LOG_LOGSYSTEM_CLASS,"o
> rg.apache.velo
> city.runtime.log.SimpleLog4JLogSystem");
> ve.setProperty("runtime.log.logsystem.log4j.category",
> "com.forio.velocity");
> ve.init();
> 
> 
> WILL
> 
> 
> _______________________________________
> Forio Business Simulations
> 
> Will Glass-Husain
> wglass@forio.com
> www.forio.com
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: velocity-user-help@jakarta.apache.org
> 


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