Author: jleroux
Date: Fri Jul 13 13:41:11 2007 New Revision: 556141 URL: http://svn.apache.org/viewvc?view=rev&rev=556141 Log: A patch from Adriam Crum "Small Fixups for OFBIZ-642" (https://issues.apache.org/jira/browse/OFBIZ-1147) Modified: ofbiz/trunk/framework/common/src/org/ofbiz/common/CommonEvents.java ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/HtmlWidget.java ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/ScreenWidgetViewHandler.java Modified: ofbiz/trunk/framework/common/src/org/ofbiz/common/CommonEvents.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/common/src/org/ofbiz/common/CommonEvents.java?view=diff&rev=556141&r1=556140&r2=556141 ============================================================================== --- ofbiz/trunk/framework/common/src/org/ofbiz/common/CommonEvents.java (original) +++ ofbiz/trunk/framework/common/src/org/ofbiz/common/CommonEvents.java Fri Jul 13 13:41:11 2007 @@ -187,7 +187,7 @@ } } } - return setSessionTimeZone(request, response); + return "success"; } /** Simple event to set the user's per-session time zone setting. */ @@ -243,5 +243,6 @@ return "success"; } } + Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/HtmlWidget.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/HtmlWidget.java?view=diff&rev=556141&r1=556140&r2=556141 ============================================================================== --- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/HtmlWidget.java (original) +++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/HtmlWidget.java Fri Jul 13 13:41:11 2007 @@ -35,8 +35,6 @@ import org.w3c.dom.Element; import freemarker.template.TemplateException; -import freemarker.template.TemplateModelException; -import freemarker.template.utility.StandardCompress; /** * Widget Library - Screen model HTML class @@ -75,18 +73,8 @@ //Debug.logInfo("Rendering template at location [" + location + "] with context: \n" + context, module); if (location.endsWith(".ftl")) { - StandardCompress compress = new StandardCompress(); - String compressHTML = null; - Map parametersMap = (Map) context.get("parameters"); - if (parametersMap != null) { - compressHTML = (String) parametersMap.get("compressHTML"); - } try { - if ("true".equals(compressHTML)) { - FreeMarkerWorker.renderTemplateAtLocation(location, context, compress.getWriter(writer, null)); - } else { - FreeMarkerWorker.renderTemplateAtLocation(location, context, writer); - } + FreeMarkerWorker.renderTemplateAtLocation(location, context, writer); } catch (MalformedURLException e) { String errMsg = "Error rendering included template at location [" + location + "]: " + e.toString(); Debug.logError(e, errMsg, module); @@ -186,6 +174,7 @@ } } } + Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/ScreenWidgetViewHandler.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/ScreenWidgetViewHandler.java?view=diff&rev=556141&r1=556140&r2=556141 ============================================================================== --- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/ScreenWidgetViewHandler.java (original) +++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/ScreenWidgetViewHandler.java Fri Jul 13 13:41:11 2007 @@ -36,6 +36,9 @@ import org.ofbiz.widget.html.HtmlFormRenderer; import org.xml.sax.SAXException; +import freemarker.template.TemplateModelException; +import freemarker.template.utility.StandardCompress; + /** * Handles view rendering for the Screen Widget */ @@ -71,6 +74,17 @@ writer = response.getWriter(); } + // compress HTML output if configured to do so + String compressHTML = null; + if (this.servletContext != null) { + compressHTML = (String) this.servletContext.getAttribute("compressHTML"); + } + if ("true".equals(compressHTML)) { + // StandardCompress defaults to a 2k buffer. That could be increased + // to speed up output. + writer = new StandardCompress().getWriter(writer, null); + } + ScreenRenderer screens = new ScreenRenderer(writer, null, htmlScreenRenderer); screens.populateContextForRequest(request, response, servletContext); // this is the object used to render forms from their definitions @@ -84,6 +98,8 @@ throw new ViewHandlerException("XML Error rendering page: " + e.toString(), e); } catch (GeneralException e) { throw new ViewHandlerException("Lower level error rendering page: " + e.toString(), e); - } + } catch (TemplateModelException e) { + throw new ViewHandlerException("Whitespace compression error rendering page: " + e.toString(), e); + } } } |
Free forum by Nabble | Edit this page |