From 1c9f9f5f1aed59d1cb71e915567f5e6f3b9207f7 Mon Sep 17 00:00:00 2001 From: j2blake Date: Thu, 8 Aug 2013 13:23:40 -0400 Subject: [PATCH] VIVO-246 Re-implement the FreemarkerConfiguration The Configuration must contain mutable information like the theme directory and the TemplateLoader. It must also be request-specific so it can have the correct Locale for language support. But we should only have one instance, so there is only one TemplateCache (alternatively, one TemplateCache per theme). Previously, this was addressed by intercepting the Template processing and adding the request-based info to the Environment. However, this interception code needed to appear each time a Template was processed. This was sometimes overlooked, and at best introduced a bunch of duplicated code. Instead, I extended the freemarker Configuration class to include a ThreadLocal that holds request-specific information. --- productMods/WEB-INF/resources/startup_listeners.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/productMods/WEB-INF/resources/startup_listeners.txt b/productMods/WEB-INF/resources/startup_listeners.txt index d27cd019..6b723f64 100644 --- a/productMods/WEB-INF/resources/startup_listeners.txt +++ b/productMods/WEB-INF/resources/startup_listeners.txt @@ -72,6 +72,7 @@ edu.cornell.mannlib.vitro.webapp.search.solr.VivoDocumentModifiers edu.cornell.mannlib.vitro.webapp.search.solr.SolrSetup edu.cornell.mannlib.vitro.webapp.controller.freemarker.FreemarkerSetup +edu.cornell.mannlib.vitro.webapp.freemarker.config.FreemarkerConfiguration$Setup # On shutdown, this will kill the background thread started by Apache Commons File Upload org.apache.commons.fileupload.servlet.FileCleanerCleanup