Author: doogie
Date: Sun Jun 28 23:50:53 2009 New Revision: 789177 URL: http://svn.apache.org/viewvc?rev=789177&view=rev Log: Switch to ContentUrlTag.appendContentPrefix to StringBuilder, and deprecate to the StringBuffer variant. Modified: ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/ftl/OfbizContentTransform.java ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/taglib/ContentUrlTag.java ofbiz/trunk/framework/widget/src/org/ofbiz/widget/WidgetWorker.java ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/MacroFormRenderer.java ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlFormRenderer.java ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlMenuRenderer.java ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlScreenRenderer.java ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlTreeRenderer.java ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/MacroScreenRenderer.java Modified: ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/ftl/OfbizContentTransform.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/ftl/OfbizContentTransform.java?rev=789177&r1=789176&r2=789177&view=diff ============================================================================== --- ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/ftl/OfbizContentTransform.java (original) +++ ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/ftl/OfbizContentTransform.java Sun Jun 28 23:50:53 2009 @@ -61,7 +61,7 @@ String requestUrl = buf.toString(); // make the link - StringBuffer newURL = new StringBuffer(); + StringBuilder newURL = new StringBuilder(); ContentUrlTag.appendContentPrefix(request, newURL); if (newURL.length() > 0 && newURL.charAt(newURL.length() - 1) != '/' && requestUrl.charAt(0) != '/') { newURL.append('/'); Modified: ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/taglib/ContentUrlTag.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/taglib/ContentUrlTag.java?rev=789177&r1=789176&r2=789177&view=diff ============================================================================== --- ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/taglib/ContentUrlTag.java (original) +++ ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/taglib/ContentUrlTag.java Sun Jun 28 23:50:53 2009 @@ -38,7 +38,14 @@ public static final String module = UrlTag.class.getName(); + @Deprecated public static void appendContentPrefix(HttpServletRequest request, StringBuffer urlBuffer) { + StringBuilder urlBuilder = new StringBuilder(); + appendContentPrefix(request, urlBuilder); + urlBuffer.append(urlBuilder); + } + + public static void appendContentPrefix(HttpServletRequest request, StringBuilder urlBuffer) { if (request == null) { Debug.logWarning("WARNING: request was null in appendContentPrefix; this probably means this was used where it shouldn't be, like using ofbizContentUrl in a screen rendered through a service; using best-bet behavior: standard prefix from url.properties (no WebSite or security setting known)", module); String prefix = UtilProperties.getPropertyValue("url", "content.url.prefix.standard"); @@ -70,7 +77,7 @@ } public static String getContentPrefix(HttpServletRequest request) { - StringBuffer buf = new StringBuffer(); + StringBuilder buf = new StringBuilder(); ContentUrlTag.appendContentPrefix(request, buf); return buf.toString(); } @@ -81,7 +88,7 @@ BodyContent body = getBodyContent(); String bodyString = body.getString(); - StringBuffer newURL = new StringBuffer(); + StringBuilder newURL = new StringBuilder(); appendContentPrefix(request, newURL); newURL.append(bodyString); Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/WidgetWorker.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/WidgetWorker.java?rev=789177&r1=789176&r2=789177&view=diff ============================================================================== --- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/WidgetWorker.java (original) +++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/WidgetWorker.java Sun Jun 28 23:50:53 2009 @@ -114,7 +114,7 @@ } public static void appendContentUrl(Appendable writer, String location, HttpServletRequest request) throws IOException { - StringBuffer buffer = new StringBuffer(); + StringBuilder buffer = new StringBuilder(); ContentUrlTag.appendContentPrefix(request, buffer); writer.append(buffer.toString()); writer.append(location); Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/MacroFormRenderer.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/MacroFormRenderer.java?rev=789177&r1=789176&r2=789177&view=diff ============================================================================== --- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/MacroFormRenderer.java (original) +++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/MacroFormRenderer.java Sun Jun 28 23:50:53 2009 @@ -2241,7 +2241,7 @@ String width = ""; String height = ""; if (UtilValidate.isNotEmpty(value)) { - StringBuffer buffer = new StringBuffer(); + StringBuilder buffer = new StringBuilder(); ContentUrlTag.appendContentPrefix(request, buffer); buffer.append(value); value = buffer.toString(); @@ -2626,7 +2626,7 @@ executeMacro(sr.toString()); } public void appendContentUrl(Appendable writer, String location) throws IOException { - StringBuffer buffer = new StringBuffer(); + StringBuilder buffer = new StringBuilder(); ContentUrlTag.appendContentPrefix(this.request, buffer); writer.append(buffer.toString()); writer.append(location); Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlFormRenderer.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlFormRenderer.java?rev=789177&r1=789176&r2=789177&view=diff ============================================================================== --- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlFormRenderer.java (original) +++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlFormRenderer.java Sun Jun 28 23:50:53 2009 @@ -107,7 +107,7 @@ } public void appendContentUrl(Appendable writer, String location) throws IOException { - StringBuffer buffer = new StringBuffer(); + StringBuilder buffer = new StringBuilder(); ContentUrlTag.appendContentPrefix(this.request, buffer); writer.append(buffer.toString()); writer.append(location); @@ -2667,7 +2667,7 @@ String value = modelFormField.getEntry(context, imageField.getValue(context)); if (UtilValidate.isNotEmpty(value)) { writer.append(" src=\""); - StringBuffer buffer = new StringBuffer(); + StringBuilder buffer = new StringBuilder(); ContentUrlTag.appendContentPrefix(request, buffer); writer.append(buffer.toString()); writer.append(value); Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlMenuRenderer.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlMenuRenderer.java?rev=789177&r1=789176&r2=789177&view=diff ============================================================================== --- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlMenuRenderer.java (original) +++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlMenuRenderer.java Sun Jun 28 23:50:53 2009 @@ -110,7 +110,7 @@ if (delegator == null) { //if (Debug.infoOn()) Debug.logInfo("in appendContentUrl, delegator is null(6)", ""); } - StringBuffer buffer = new StringBuffer(); + StringBuilder buffer = new StringBuilder(); ContentUrlTag.appendContentPrefix(this.request, buffer); writer.append(buffer.toString()); writer.append(location); @@ -556,7 +556,7 @@ } } else if (urlMode != null && urlMode.equalsIgnoreCase("content")) { if (request != null && response != null) { - StringBuffer newURL = new StringBuffer(); + StringBuilder newURL = new StringBuilder(); ContentUrlTag.appendContentPrefix(request, newURL); newURL.append(src); writer.append(newURL.toString()); Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlScreenRenderer.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlScreenRenderer.java?rev=789177&r1=789176&r2=789177&view=diff ============================================================================== --- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlScreenRenderer.java (original) +++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlScreenRenderer.java Sun Jun 28 23:50:53 2009 @@ -618,7 +618,7 @@ } } else if (urlMode != null && urlMode.equalsIgnoreCase("content")) { if (request != null && response != null) { - StringBuffer newURL = new StringBuffer(); + StringBuilder newURL = new StringBuilder(); ContentUrlTag.appendContentPrefix(request, newURL); newURL.append(src); writer.append(newURL.toString()); Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlTreeRenderer.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlTreeRenderer.java?rev=789177&r1=789176&r2=789177&view=diff ============================================================================== --- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlTreeRenderer.java (original) +++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlTreeRenderer.java Sun Jun 28 23:50:53 2009 @@ -233,7 +233,7 @@ writer.append(target); } } else if (urlMode != null && urlMode.equalsIgnoreCase("content")) { - StringBuffer newURL = new StringBuffer(); + StringBuilder newURL = new StringBuilder(); ContentUrlTag.appendContentPrefix(req, newURL); newURL.append(target); writer.append(newURL.toString()); @@ -318,7 +318,7 @@ } } else if (urlMode != null && urlMode.equalsIgnoreCase("content")) { if (request != null && response != null) { - StringBuffer newURL = new StringBuffer(); + StringBuilder newURL = new StringBuilder(); ContentUrlTag.appendContentPrefix(request, newURL); newURL.append(src); writer.append(newURL.toString()); Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/MacroScreenRenderer.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/MacroScreenRenderer.java?rev=789177&r1=789176&r2=789177&view=diff ============================================================================== --- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/MacroScreenRenderer.java (original) +++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/MacroScreenRenderer.java Sun Jun 28 23:50:53 2009 @@ -308,7 +308,7 @@ } } else if (urlMode != null && urlMode.equalsIgnoreCase("content")) { if (request != null && response != null) { - StringBuffer newURL = new StringBuffer(); + StringBuilder newURL = new StringBuilder(); ContentUrlTag.appendContentPrefix(request, newURL); newURL.append(src); urlString = newURL.toString(); |
Free forum by Nabble | Edit this page |