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 7093b5962..3c67fe17c 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 @@ -17,7 +17,6 @@ import org.apache.commons.logging.LogFactory; import edu.cornell.mannlib.vitro.webapp.beans.ApplicationBean; import edu.cornell.mannlib.vitro.webapp.config.ConfigurationProperties; import edu.cornell.mannlib.vitro.webapp.config.RevisionInfoBean; -import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest; import edu.cornell.mannlib.vitro.webapp.controller.freemarker.UrlBuilder.Route; import edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.EditConfigurationConstants; import edu.cornell.mannlib.vitro.webapp.web.methods.IndividualLocalNameMethod; @@ -40,14 +39,12 @@ public class FreemarkerConfiguration extends Configuration { private final String themeDir; private final ServletContext context; private final ApplicationBean appBean; - private final String appName; - FreemarkerConfiguration(String themeDir, VitroRequest vreq, ServletContext context) { + FreemarkerConfiguration(String themeDir, ApplicationBean appBean, ServletContext context) { this.themeDir = themeDir; this.context = context; - this.appBean = vreq.getAppBean(); - this.appName = appBean.getApplicationName(); + this.appBean = appBean; String buildEnv = ConfigurationProperties.getBean(context).getProperty("Environment.build"); log.debug("Current build environment: " + buildEnv); @@ -88,7 +85,7 @@ public class FreemarkerConfiguration extends Configuration { setTemplateLoader(createTemplateLoader()); - setSharedVariables(vreq); + setSharedVariables(); } @@ -96,13 +93,12 @@ public class FreemarkerConfiguration extends Configuration { * These are values that are accessible to all * templates loaded by the Configuration's TemplateLoader. They * should be application- rather than request-specific. - * @param VitroRequest vreq */ - private void setSharedVariables(VitroRequest vreq) { + private void setSharedVariables() { Map sharedVariables = new HashMap(); - sharedVariables.put("siteName", appName); + sharedVariables.put("siteName", appBean.getApplicationName()); sharedVariables.put("version", getRevisionInfo()); sharedVariables.put("urls", getSiteUrls()); sharedVariables.put("themeDir", themeDir); diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/freemarker/FreemarkerConfigurationLoader.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/freemarker/FreemarkerConfigurationLoader.java index 4b2f766c1..261aa00ca 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/freemarker/FreemarkerConfigurationLoader.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/freemarker/FreemarkerConfigurationLoader.java @@ -22,7 +22,7 @@ public class FreemarkerConfigurationLoader { public static FreemarkerConfiguration getConfig(VitroRequest vreq, ServletContext context) { String themeDir = getThemeDir(vreq.getAppBean()); - return getConfigForTheme(themeDir, vreq, context); + return getConfigForTheme(themeDir, vreq.getAppBean(), context); } private static String getThemeDir(ApplicationBean appBean) { @@ -46,16 +46,16 @@ public class FreemarkerConfigurationLoader { * 1. The template loader is theme-specific, since it specifies a theme * directory to load templates from. * - * 2. Shared variables like stylesheets are theme-specific. + * 2. Some shared variables are theme-specific. */ private static FreemarkerConfiguration getConfigForTheme(String themeDir, - VitroRequest vreq, ServletContext context) { + ApplicationBean appBean, ServletContext context) { synchronized (themeToConfigMap) { if (themeToConfigMap.containsKey(themeDir)) { return themeToConfigMap.get(themeDir); } else { FreemarkerConfiguration config = new FreemarkerConfiguration( - themeDir, vreq, context); + themeDir, appBean, context); themeToConfigMap.put(themeDir, config); return config; }