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.
This commit is contained in:
j2blake 2013-08-08 13:23:40 -04:00
parent 6950aab59c
commit 1c9f9f5f1a

View file

@ -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.search.solr.SolrSetup
edu.cornell.mannlib.vitro.webapp.controller.freemarker.FreemarkerSetup 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 # On shutdown, this will kill the background thread started by Apache Commons File Upload
org.apache.commons.fileupload.servlet.FileCleanerCleanup org.apache.commons.fileupload.servlet.FileCleanerCleanup