Further magic to support loading Velocity templates from the file system

during webapp development.


git-svn-id: https://samskivert.googlecode.com/svn/trunk@1550 6335cc39-0255-0410-8fd6-9bcaacd3b74c
This commit is contained in:
mdb
2004-12-18 01:01:44 +00:00
parent 2d1e549454
commit 37858624b8
@@ -228,16 +228,25 @@ public class DispatcherServlet extends VelocityServlet
"from file '" + INIT_PROPS_KEY + "'.");
}
// wire up our site resource manager if a site-specific jar file
// path was provided
SiteResourceLoader siteLoader = _app.getSiteResourceLoader();
if (siteLoader != null) {
props.setProperty(RuntimeSingleton.RESOURCE_MANAGER_CLASS,
SiteResourceManager.class.getName());
} else {
// otherwise use a servlet context resource loader
props.setProperty(RuntimeSingleton.RESOURCE_MANAGER_CLASS,
ServletContextResourceManager.class.getName());
// let the application set up velocity properties
_app.configureVelocity(config, props);
// if no file resource loader path has been set and a
// site-specific jar file path was provided, wire up our site
// resource manager
if (props.getProperty("file.resource.loader.path") == null) {
SiteResourceLoader siteLoader = _app.getSiteResourceLoader();
if (siteLoader != null) {
Log.info("Velocity loading templates from site loader.");
props.setProperty(RuntimeSingleton.RESOURCE_MANAGER_CLASS,
SiteResourceManager.class.getName());
} else {
// otherwise use a servlet context resource loader
Log.info("Velocity loading templates from servlet context.");
props.setProperty(
RuntimeSingleton.RESOURCE_MANAGER_CLASS,
ServletContextResourceManager.class.getName());
}
}
// wire up our #import directive
@@ -247,9 +256,6 @@ public class DispatcherServlet extends VelocityServlet
props.setProperty(RuntimeSingleton.RUNTIME_LOG_LOGSYSTEM_CLASS,
ServletContextLogger.class.getName());
// let the application set up other properties
_app.configureVelocity(config, props);
// now return our augmented properties
return props;
}