Skip to content

Commit

Permalink
Upgraded to the latest, now official, release of Freemarker
Browse files Browse the repository at this point in the history
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1631299 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information
jacopoc committed Oct 13, 2014
1 parent 4e01843 commit 8657d89
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 8 deletions.
2 changes: 1 addition & 1 deletion .classpath
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,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.21-rc02.jar"/>
<classpathentry kind="lib" path="framework/base/lib/freemarker-2.3.21.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"/>
Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ framework/base/lib/avalon-framework-4.2.0.jar
framework/base/lib/batik-all-1.7.jar
framework/base/lib/barcode4j-2.1-barcode4j-fop-ext-complete.jar
framework/base/lib/clhm-release-1.0-lru.jar
framework/base/lib/freemarker-2.3.21.jar
framework/base/lib/httpclient-4.2.1.jar
framework/base/lib/httpclient-cache-4.2.1.jar
framework/base/lib/httpcore-4.2.1.jar
Expand Down Expand Up @@ -435,7 +436,6 @@ 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.21-rc02.jar
framework/base/lib/hamcrest-all-1.2.jar
framework/base/lib/httpunit-1.7.jar
framework/base/lib/ical4j-1.0-rc2.jar
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@
import freemarker.core.Environment;
import freemarker.ext.beans.BeanModel;
import freemarker.ext.beans.BeansWrapper;
import freemarker.ext.beans.BeansWrapperBuilder;
import freemarker.template.Configuration;
import freemarker.template.SimpleHash;
import freemarker.template.SimpleScalar;
Expand All @@ -79,17 +80,13 @@ public class FreeMarkerWorker {

// 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(version));
private static final BeansWrapper defaultOfbizWrapper = new BeansWrapperBuilder(version).build();
private static final Configuration defaultOfbizConfig = makeConfiguration(defaultOfbizWrapper);

public static BeansWrapper getDefaultOfbizWrapper() {
return defaultOfbizWrapper;
}

public static <T extends BeansWrapper> T configureBeansWrapper(T wrapper) {
return wrapper;
}

public static Configuration makeConfiguration(BeansWrapper wrapper) {
Configuration newConfig = new Configuration(version);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ 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(FreeMarkerWorker.version)));
protected static Configuration specialConfig = FreeMarkerWorker.makeConfiguration(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 {
Expand Down

0 comments on commit 8657d89

Please sign in to comment.