Upgrade to the most recent version of Freemarker-2.3-gae: this is not an official release yet but it will be soon; I have committed this work, as discussed in the dev list, in order to get help from the community to test this new improved version of Freemarker and provide feedback to the Freemarker community.
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1605029 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
+1
-1
@@ -23,7 +23,7 @@
|
||||
<classpathentry kind="lib" path="framework/base/lib/clhm-release-1.0-lru.jar"/>
|
||||
<classpathentry kind="lib" path="framework/base/lib/hamcrest-all-1.2.jar"/>
|
||||
<classpathentry kind="lib" path="framework/base/lib/fop-1.1.jar"/>
|
||||
<classpathentry kind="lib" path="framework/base/lib/freemarker-2.3.19-null-wildcards.jar"/>
|
||||
<classpathentry kind="lib" path="framework/base/lib/freemarker-2.3-gae-d4ffa9e3727b83b95fd546591aa15dbad0118bd0.jar"/>
|
||||
<classpathentry kind="lib" path="framework/base/lib/httpclient-4.2.1.jar"/>
|
||||
<classpathentry kind="lib" path="framework/base/lib/httpclient-cache-4.2.1.jar"/>
|
||||
<classpathentry kind="lib" path="framework/base/lib/httpcore-4.2.1.jar"/>
|
||||
|
||||
@@ -444,7 +444,7 @@ BSD License:
|
||||
applications/content/lib/dom4j-1.6.1.jar
|
||||
framework/base/lib/antisamy-bin.1.2.jar
|
||||
framework/base/lib/bsh-engine-modified.jar
|
||||
framework/base/lib/freemarker-2.3.19-null-wildcards.jar
|
||||
framework/base/lib/freemarker-2.3-gae-d4ffa9e3727b83b95fd546591aa15dbad0118bd0.jar
|
||||
framework/base/lib/hamcrest-all-1.2.jar
|
||||
framework/base/lib/httpunit-1.7.jar
|
||||
framework/base/lib/ical4j-1.0-rc2.jar
|
||||
|
||||
Binary file not shown.
Binary file not shown.
@@ -66,6 +66,7 @@ import freemarker.template.TemplateException;
|
||||
import freemarker.template.TemplateExceptionHandler;
|
||||
import freemarker.template.TemplateModel;
|
||||
import freemarker.template.TemplateModelException;
|
||||
import freemarker.template.Version;
|
||||
|
||||
/** FreeMarkerWorker - Freemarker Template Engine Utilities.
|
||||
*
|
||||
@@ -74,9 +75,11 @@ public class FreeMarkerWorker {
|
||||
|
||||
public static final String module = FreeMarkerWorker.class.getName();
|
||||
|
||||
public static final Version version = new Version(2, 3, 21);
|
||||
|
||||
// use soft references for this so that things from Content records don't kill all of our memory, or maybe not for performance reasons... hmmm, leave to config file...
|
||||
private static final UtilCache<String, Template> cachedTemplates = UtilCache.createUtilCache("template.ftl.general", 0, 0, false);
|
||||
private static final BeansWrapper defaultOfbizWrapper = configureBeansWrapper(new BeansWrapper());
|
||||
private static final BeansWrapper defaultOfbizWrapper = configureBeansWrapper(new BeansWrapper(version));
|
||||
private static final Configuration defaultOfbizConfig = makeConfiguration(defaultOfbizWrapper);
|
||||
|
||||
public static BeansWrapper getDefaultOfbizWrapper() {
|
||||
@@ -84,12 +87,11 @@ public class FreeMarkerWorker {
|
||||
}
|
||||
|
||||
public static <T extends BeansWrapper> T configureBeansWrapper(T wrapper) {
|
||||
wrapper.setNullWildcards(true);
|
||||
return wrapper;
|
||||
}
|
||||
|
||||
public static Configuration makeConfiguration(BeansWrapper wrapper) {
|
||||
Configuration newConfig = new Configuration();
|
||||
Configuration newConfig = new Configuration(version);
|
||||
|
||||
newConfig.setObjectWrapper(wrapper);
|
||||
newConfig.setSharedVariable("Static", wrapper.getStaticModels());
|
||||
|
||||
@@ -49,6 +49,7 @@ import freemarker.template.Template;
|
||||
import freemarker.template.TemplateException;
|
||||
import freemarker.template.TemplateModel;
|
||||
import freemarker.template.TemplateModelException;
|
||||
import freemarker.template.Version;
|
||||
|
||||
/**
|
||||
* Widget Library - Screen model HTML class.
|
||||
@@ -58,10 +59,14 @@ public class HtmlWidget extends ModelScreenWidget {
|
||||
public static final String module = HtmlWidget.class.getName();
|
||||
|
||||
private static final UtilCache<String, Template> specialTemplateCache = UtilCache.createUtilCache("widget.screen.template.ftl.general", 0, 0, false);
|
||||
protected static Configuration specialConfig = FreeMarkerWorker.makeConfiguration(FreeMarkerWorker.configureBeansWrapper(new ExtendedWrapper()));
|
||||
protected static Configuration specialConfig = FreeMarkerWorker.makeConfiguration(FreeMarkerWorker.configureBeansWrapper(new ExtendedWrapper(FreeMarkerWorker.version)));
|
||||
|
||||
// not sure if this is the best way to get FTL to use my fancy MapModel derivative, but should work at least...
|
||||
public static class ExtendedWrapper extends BeansWrapper {
|
||||
public ExtendedWrapper(Version version) {
|
||||
super(version);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public TemplateModel wrap(Object object) throws TemplateModelException {
|
||||
|
||||
Reference in New Issue
Block a user