velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ben Peter <>
Subject Re: How can a list of available templates be obtained?
Date Thu, 28 Mar 2002 21:58:57 GMT
Geir Magnusson Jr. wrote:
> On 3/28/02 2:13 AM, "Ben Peter" <> wrote:
>>is there a way of obtaining a list of templates that a loader can provide?
> Not really.  The problem is that a loader generally has a large space from
> which it can load.  For example, the FileResourceLoader can access anything
> below any of it's path nodes.  In practice, this is generally small, because
> people usually configure with some limited directory like a /templates
> directory in their webapp tree, but that too can contain multiple
> directories...


Yes, I feared that, and it makes sense. However, it would be nice if 
java.lang.Classloader had something similar to ServletContext's 
getResourcePaths(String path), which gives you all available resources in one 


> What you might do is extend the JarResourceLoader and use the Application
> Attributes (see dev guide) feature to allow your app level code to talk to
> the loader.  Then your loader can do fancy things for you and make them
> available to the app.

Hm, I'll probably not go that far, as it is only a matter of making deployment 
easier. I'll probably just generate a list of templates at deployment time and 
read that from a config file.

If I find the time, I'll probably look at whether something of general use can 
be added to the JarResourceLoader, if that is of any use to others as well.

Thanks a lot for your answers.

> geir
Benjamin Peter                                          +49-69-96244395
Application Engineer                             Moerfelder Landstr. 55
(zentropy:partners)                            60598 Frankfurt, Germany

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

View raw message