svn commit: r739785 - /ofbiz/trunk/framework/base/src/org/ofbiz/base/util/template/FreeMarkerWorker.java

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit: r739785 - /ofbiz/trunk/framework/base/src/org/ofbiz/base/util/template/FreeMarkerWorker.java

jacopoc
Author: jacopoc
Date: Sun Feb  1 16:54:53 2009
New Revision: 739785

URL: http://svn.apache.org/viewvc?rev=739785&view=rev
Log:
Modified two FreeMarkerWorker methods to return the Environment object; no functional change, but this mode is required by the upcoming new screen renderer based on Freemarker macros.

Modified:
    ofbiz/trunk/framework/base/src/org/ofbiz/base/util/template/FreeMarkerWorker.java

Modified: ofbiz/trunk/framework/base/src/org/ofbiz/base/util/template/FreeMarkerWorker.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/src/org/ofbiz/base/util/template/FreeMarkerWorker.java?rev=739785&r1=739784&r2=739785&view=diff
==============================================================================
--- ofbiz/trunk/framework/base/src/org/ofbiz/base/util/template/FreeMarkerWorker.java (original)
+++ ofbiz/trunk/framework/base/src/org/ofbiz/base/util/template/FreeMarkerWorker.java Sun Feb  1 16:54:53 2009
@@ -162,7 +162,7 @@
         renderTemplate(template, context, outWriter);
     }
 
-    public static void renderTemplateFromString(String templateString, String templateLocation, Map<String, Object> context, Appendable outWriter) throws TemplateException, IOException {
+    public static Environment renderTemplateFromString(String templateString, String templateLocation, Map<String, Object> context, Appendable outWriter) throws TemplateException, IOException {
         Template template = cachedTemplates.get(templateLocation);
         if (template == null) {
             synchronized (cachedTemplates) {
@@ -176,7 +176,7 @@
             }
         }
         
-        renderTemplate(template, context, outWriter);
+        return renderTemplate(template, context, outWriter);
     }
 
     /**
@@ -185,7 +185,7 @@
      * @param context The context Map
      * @param outWriter The Writer to render to
      */
-    public static void renderTemplate(Template template, Map<String, Object> context, Appendable outWriter) throws TemplateException, IOException {
+    public static Environment renderTemplate(Template template, Map<String, Object> context, Appendable outWriter) throws TemplateException, IOException {
         // make sure there is no "null" string in there as FreeMarker will try to use it
         context.remove("null");
         // Since the template cache keeps a single instance of a Template that is shared among users,
@@ -198,6 +198,7 @@
         Environment env = template.createProcessingEnvironment(context, (Writer)outWriter);
         applyUserSettings(env, context);
         env.process();
+        return env;
     }
     
     /**