velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Will Glass-Husain <>
Subject Re: ClasspathResourceLoader with/without leading slash
Date Mon, 17 Jul 2006 20:40:46 GMT
Hi Bradley,

I think this works in the (as yet) unreleased Velocity 1.5.  It's pretty 
stable, you can download it, compile it and use it.

If you want to make it relative, you might try writing your own resource 
loader.  It's a fairly simple API.  Just grab the code for 
ClasspathResourceLoader from the source and modify it.  Then specify 
this custom resource loader in your

There's some more info on writing custom resource loaders on the Wiki 
here and elsewhere:

Best, WILL

Bradley Wagner wrote:
> I'm using Velocity-1.4 and I'm experiencing problems with loading 
> templates using the ClasspathResourceLoader. Basically, the only way I 
> can get it to work is by dropping the leading slash on my absolute 
> classpath.
> Template template = Velocity.getTemplate("class/path/to/file")
> Also, is there any way to reference something relative to your current 
> class as you can do with the resource loader in Java?
> MyClass.class.getResourceAsStream("./relative/to/current")
> Thanks,
> Bradley
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:

Forio Business Simulations

Will Glass-Husain
phone (415) 440-7500 x89
mobile (415) 235-4293

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message