| org.sakaiproject.search.tool.WebappLoader
WebappLoader | public class WebappLoader extends ResourceLoader (Code) | | Resource loader that uses the ServletContext of a webapp to
load Velocity templates. (it's much easier to use with servlets than
the standard FileResourceLoader, in particular the use of war files
is transparent).
The default search path is '/' (relative to the webapp root), but
you can change this behaviour by specifying one or more paths
by mean of as many webapp.resource.loader.path properties as needed
in the velocity.properties file.
All paths must be relative to the root of the webapp.
To enable caching and cache refreshing the webapp.resource.loader.cache and
webapp.resource.loader.modificationCheckInterval properties need to be
set in the velocity.properties file ... auto-reloading of global macros
requires the webapp.resource.loader.cache property to be set to 'false'.
author: Geir Magnusson Jr. author: Nathan Bubna author: Claude Brisson version: $Id: WebappLoader.java 22723 2007-03-16 01:35:32Z ian@caret.cam.ac.uk $ |
Method Summary | |
public long | getLastModified(Resource resource) | public synchronized InputStream | getResourceStream(String name) Get an InputStream so that the Runtime can build a
template with it. | public void | init(ExtendedProperties configuration) This is abstract in the base class, so we need it.
NOTE: this expects that the ServletContext has already
been placed in the runtime's application attributes
under its full class name (i.e. | public boolean | isSourceModified(Resource resource) Checks to see if a resource has been deleted, moved or modified. |
paths | protected String[] paths(Code) | | The root paths for templates (relative to webapp's root).
|
getLastModified | public long getLastModified(Resource resource)(Code) | | Checks to see when a resource was last modified
Parameters: resource - Resource the resource to check long The time when the resource was last modified or 0 if the file can't be read |
getResourceStream | public synchronized InputStream getResourceStream(String name) throws ResourceNotFoundException(Code) | | Get an InputStream so that the Runtime can build a
template with it.
Parameters: name - name of template to get InputStream containing the template throws: ResourceNotFoundException - if template not foundin classpath. |
init | public void init(ExtendedProperties configuration)(Code) | | This is abstract in the base class, so we need it.
NOTE: this expects that the ServletContext has already
been placed in the runtime's application attributes
under its full class name (i.e. "javax.servlet.ServletContext").
Parameters: configuration - the ExtendedProperties associated withthis resource loader. |
isSourceModified | public boolean isSourceModified(Resource resource)(Code) | | Checks to see if a resource has been deleted, moved or modified.
Parameters: resource - Resource The resource to check for modification boolean True if the resource has been modified |
|
|