You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by "Gerald E. Bennett" <mr...@austin.rr.com> on 2001/06/21 19:27:12 UTC

Directory listing capability for Resource Loaders

Hi everyone,

I am trying to figure out if Resource Loaders have the capability to list
all available templates
that area available to them ?

For example, a FilResourceLoader would give a list of all filenames for each
of the directories listed in the
resource.loader.path.

Similar a Classpath loader would list all template filename available in the
classpath.
It would also be nice if I could only list filenames with a particular
extension.


Sincerely,

Gerald E. Bennett


Re: Directory listing capability for Resource Loaders

Posted by "Geir Magnusson Jr." <ge...@optonline.net>.
"Gerald E. Bennett" wrote:
> 
> Hi everyone,
> 
> I am trying to figure out if Resource Loaders have the capability to list
> all available templates
> that area available to them ?
> 
> For example, a FilResourceLoader would give a list of all filenames for each
> of the directories listed in the
> resource.loader.path.

It's *possible* to do, but not probable that we would make it do that :) 

You could always write your own quickie tool that gets from the Velocity
engine the current file.resource.loader.path and checks it as you wish. 
The configuration information is easily accessable via the getProperty()
method in the Velocity class (in org.apache.velocity.app).  Note that it
returns an Object, which could be a String[].

> 
> Similar a Classpath loader would list all template filename available in the
> classpath.

That's harder.  As rafal said, see the docs on Classloader to see why
that's hard. :)

> It would also be nice if I could only list filenames with a particular
> extension.

While the tradition if .vm, there is nothing that says a template has to
have any extension....

geir

-- 
Geir Magnusson Jr.                           geirm@optonline.net
System and Software Consulting
Developing for the web?  See http://jakarta.apache.org/velocity/
You have a genius for suggesting things I've come a cropper with!

Re: Directory listing capability for Resource Loaders

Posted by Rafal Krzewski <Ra...@e-point.pl>.
"Gerald E. Bennett" wrote:

> I am trying to figure out if Resource Loaders have the capability to list
> all available templates
> that area available to them ?

> Similar a Classpath loader would list all template filename available in the
> classpath.
> It would also be nice if I could only list filenames with a particular
> extension.

Please read the API for java.lang.ClassLoader, and answer your own
question...

--
Rafal Krzewski
Senior Internet Developer
mailto:Rafal.Krzewski@e-point.pl
+48 22 8534830 http://e-point.pl