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:
@@ -228,16 +228,25 @@ public class DispatcherServlet extends VelocityServlet
|
|||||||
"from file '" + INIT_PROPS_KEY + "'.");
|
"from file '" + INIT_PROPS_KEY + "'.");
|
||||||
}
|
}
|
||||||
|
|
||||||
// wire up our site resource manager if a site-specific jar file
|
// let the application set up velocity properties
|
||||||
// path was provided
|
_app.configureVelocity(config, props);
|
||||||
SiteResourceLoader siteLoader = _app.getSiteResourceLoader();
|
|
||||||
if (siteLoader != null) {
|
// if no file resource loader path has been set and a
|
||||||
props.setProperty(RuntimeSingleton.RESOURCE_MANAGER_CLASS,
|
// site-specific jar file path was provided, wire up our site
|
||||||
SiteResourceManager.class.getName());
|
// resource manager
|
||||||
} else {
|
if (props.getProperty("file.resource.loader.path") == null) {
|
||||||
// otherwise use a servlet context resource loader
|
SiteResourceLoader siteLoader = _app.getSiteResourceLoader();
|
||||||
props.setProperty(RuntimeSingleton.RESOURCE_MANAGER_CLASS,
|
if (siteLoader != null) {
|
||||||
ServletContextResourceManager.class.getName());
|
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
|
// wire up our #import directive
|
||||||
@@ -247,9 +256,6 @@ public class DispatcherServlet extends VelocityServlet
|
|||||||
props.setProperty(RuntimeSingleton.RUNTIME_LOG_LOGSYSTEM_CLASS,
|
props.setProperty(RuntimeSingleton.RUNTIME_LOG_LOGSYSTEM_CLASS,
|
||||||
ServletContextLogger.class.getName());
|
ServletContextLogger.class.getName());
|
||||||
|
|
||||||
// let the application set up other properties
|
|
||||||
_app.configureVelocity(config, props);
|
|
||||||
|
|
||||||
// now return our augmented properties
|
// now return our augmented properties
|
||||||
return props;
|
return props;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user