Increase template update delay in non-development build from default value of 5 seconds to 60 seconds. Those who are developing templates without restarting the server should set Environment.build = development in deploy.properties for delay of 0.
This commit is contained in:
parent
07c3d735d6
commit
1c21d921eb
1 changed files with 6 additions and 4 deletions
|
@ -116,25 +116,27 @@ public class FreemarkerHttpServlet extends VitroHttpServlet {
|
||||||
private Configuration getNewConfig(String themeDir) {
|
private Configuration getNewConfig(String themeDir) {
|
||||||
|
|
||||||
Configuration config = new Configuration();
|
Configuration config = new Configuration();
|
||||||
|
|
||||||
String buildEnv = ConfigurationProperties.getProperty("Environment.build");
|
String buildEnv = ConfigurationProperties.getProperty("Environment.build");
|
||||||
log.debug("Current build environment: " + buildEnv);
|
log.debug("Current build environment: " + buildEnv);
|
||||||
if ("development".equals(buildEnv)) {
|
if ("development".equals(buildEnv)) { // Set Environment.build = development in deploy.properties
|
||||||
log.debug("Disabling Freemarker template caching in development build.");
|
log.debug("Disabling Freemarker template caching in development build.");
|
||||||
config.setTemplateUpdateDelay(0); // no template caching in development
|
config.setTemplateUpdateDelay(0); // no template caching in development
|
||||||
|
} else {
|
||||||
|
log.debug("Setting Freemarker template cache update delay.");
|
||||||
|
config.setTemplateUpdateDelay(60); // in seconds; Freemarker default is 5
|
||||||
}
|
}
|
||||||
|
|
||||||
// Specify how templates will see the data-model.
|
// Specify how templates will see the data-model.
|
||||||
// The default wrapper exposes set methods unless exposure level is set.
|
// The default wrapper exposes set methods unless exposure level is set.
|
||||||
// By default we want to block exposure of set methods.
|
// By default we want to block exposure of set methods.
|
||||||
// config.setObjectWrapper(new DefaultObjectWrapper());
|
|
||||||
BeansWrapper wrapper = new DefaultObjectWrapper();
|
BeansWrapper wrapper = new DefaultObjectWrapper();
|
||||||
wrapper.setExposureLevel(BeansWrapper.EXPOSE_PROPERTIES_ONLY);
|
wrapper.setExposureLevel(BeansWrapper.EXPOSE_PROPERTIES_ONLY);
|
||||||
config.setObjectWrapper(wrapper);
|
config.setObjectWrapper(wrapper);
|
||||||
|
|
||||||
// Set some formatting defaults. These can be overridden at the template
|
// Set some formatting defaults. These can be overridden at the template
|
||||||
// or environment (template-processing) level, or for an individual
|
// or environment (template-processing) level, or for an individual
|
||||||
// instance by using built-ins.
|
// token by using built-ins.
|
||||||
config.setLocale(java.util.Locale.US);
|
config.setLocale(java.util.Locale.US);
|
||||||
|
|
||||||
String dateFormat = "M/d/yyyy";
|
String dateFormat = "M/d/yyyy";
|
||||||
|
|
Loading…
Add table
Reference in a new issue