org.apache.velocity.runtime.resource.loader
Class FileResourceLoader
java.lang.Object
org.apache.velocity.runtime.resource.loader.ResourceLoader
org.apache.velocity.runtime.resource.loader.FileResourceLoader
public class FileResourceLoader
- extends ResourceLoader
A loader for templates stored on the file system. Treats the template
as relative to the configured root path. If the root path is empty
treats the template name as an absolute path.
- Version:
- $Id: FileResourceLoader.java 499441 2007-01-24 15:25:58Z henning $
- Author:
- Will Glass-Husain, Aki Nieminen, Jason van Zyl
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
FileResourceLoader
public FileResourceLoader()
init
public void init(ExtendedProperties configuration)
- Description copied from class:
ResourceLoader
- Initialize the template loader with a
a resources class.
- Specified by:
init
in class ResourceLoader
- See Also:
ResourceLoader.init(org.apache.commons.collections.ExtendedProperties)
getResourceStream
public InputStream getResourceStream(String templateName)
throws ResourceNotFoundException
- Get an InputStream so that the Runtime can build a
template with it.
- Specified by:
getResourceStream
in class ResourceLoader
- Parameters:
templateName
- name of template to get
- Returns:
- InputStream containing the template
- Throws:
ResourceNotFoundException
- if template not found
in the file template path.
isSourceModified
public boolean isSourceModified(Resource resource)
- How to keep track of all the modified times
across the paths. Note that a file might have
appeared in a directory which is earlier in the
path; so we should search the path and see if
the file we find that way is the same as the one
that we have cached.
- Specified by:
isSourceModified
in class ResourceLoader
- Parameters:
resource
-
- Returns:
- True if the source has been modified.
getLastModified
public long getLastModified(Resource resource)
- Description copied from class:
ResourceLoader
- Get the last modified time of the InputStream source
that was used to create the template. We need the template
here because we have to extract the name of the template
in order to locate the InputStream source.
- Specified by:
getLastModified
in class ResourceLoader
- Returns:
- Time in millis when the resource has been modified.
- See Also:
ResourceLoader.getLastModified(org.apache.velocity.runtime.resource.Resource)
Copyright © 2000-2007 The Apache Software Foundation. All Rights Reserved.