From 885bbabdae4926185ead2e5ff5dfd68ffa8bc62b Mon Sep 17 00:00:00 2001 From: j2blake Date: Wed, 9 Jan 2013 12:59:31 -0500 Subject: [PATCH] Use developer.defeatFreemarkerCache=true Previously was Environment.build=development --- .../freemarker/FreemarkerConfiguration.java | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/freemarker/FreemarkerConfiguration.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/freemarker/FreemarkerConfiguration.java index 4ef527d1e..957da18cd 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/freemarker/FreemarkerConfiguration.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/freemarker/FreemarkerConfiguration.java @@ -37,7 +37,9 @@ public class FreemarkerConfiguration extends Configuration { private static final Log log = LogFactory.getLog(FreemarkerConfiguration.class); - private final String themeDir; + private static final String PROPERTY_DEVELOPER_DEFEAT_CACHE = "developer.defeatFreemarkerCache"; + + private final String themeDir; private final ServletContext context; private final ApplicationBean appBean; @@ -47,10 +49,10 @@ public class FreemarkerConfiguration extends Configuration { this.context = context; this.appBean = appBean; - String buildEnv = ConfigurationProperties.getBean(context).getProperty("Environment.build"); - log.debug("Current build environment: " + buildEnv); - if ("development".equals(buildEnv)) { // Set Environment.build = development in deploy.properties - log.debug("Disabling Freemarker template caching in development build."); + String flag = ConfigurationProperties.getBean(context).getProperty( + PROPERTY_DEVELOPER_DEFEAT_CACHE, "false"); + if (Boolean.valueOf(flag.trim())) { + log.debug("Disabling Freemarker template caching in development build."); setTemplateUpdateDelay(0); // no template caching in development } else { int delay = 60;