Skip to content

Commit

Permalink
Narrows class resolver
Browse files Browse the repository at this point in the history
  • Loading branch information
lukaszlenart committed Feb 2, 2017
1 parent 1a8111e commit 637ad1c
Showing 1 changed file with 8 additions and 0 deletions.
Expand Up @@ -28,6 +28,7 @@
import com.opensymphony.xwork2.util.ClassLoaderUtil;
import com.opensymphony.xwork2.util.ValueStack;
import freemarker.cache.*;
import freemarker.core.TemplateClassResolver;
import freemarker.ext.jsp.TaglibFactory;
import freemarker.ext.servlet.HttpRequestHashModel;
import freemarker.ext.servlet.HttpRequestParametersHashModel;
Expand Down Expand Up @@ -318,16 +319,23 @@ protected Configuration createConfiguration(ServletContext servletContext) throw
configuration.setTemplateExceptionHandler(TemplateExceptionHandler.HTML_DEBUG_HANDLER);

if (mruMaxStrongSize > 0) {
LOG.debug("Sets Configuration.CACHE_STORAGE_KEY to strong:{}", mruMaxStrongSize);
configuration.setSetting(Configuration.CACHE_STORAGE_KEY, "strong:" + mruMaxStrongSize);
}
if (templateUpdateDelay != null) {
LOG.debug("Sets Configuration.TEMPLATE_UPDATE_DELAY_KEY to {}", templateUpdateDelay);
configuration.setSetting(Configuration.TEMPLATE_UPDATE_DELAY_KEY, templateUpdateDelay);
}
if (encoding != null) {
LOG.debug("Sets DefaultEncoding to {}", encoding);
configuration.setDefaultEncoding(encoding);
}
LOG.debug("Disabled localized lookups");
configuration.setLocalizedLookup(false);
LOG.debug("Enabled whitespace stripping");
configuration.setWhitespaceStripping(true);
LOG.debug("Sets NewBuiltinClassResolver to TemplateClassResolver.SAFER_RESOLVER");
configuration.setNewBuiltinClassResolver(TemplateClassResolver.SAFER_RESOLVER);

return configuration;
}
Expand Down

0 comments on commit 637ad1c

Please sign in to comment.