Author: hansbak
Date: Tue Jul 26 09:06:31 2011
New Revision: 1151030
URL:
http://svn.apache.org/viewvc?rev=1151030&view=revLog:
improved implementation of rev 1150271: only add contenturl prefix to javascript includes which do not start with http. Suggestion from Scott G.
Modified:
ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/ftl/OfbizContentTransform.java
ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/includes/headerHead.ftl
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=1151030&r1=1151029&r2=1151030&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 Tue Jul 26 09:06:31 2011
@@ -44,7 +44,7 @@ public class OfbizContentTransform imple
public final static String module = OfbizContentTransform.class.getName();
@SuppressWarnings("unchecked")
- private static String getArg(Map args, String key) {
+ private static String getArg(Map args, String key) {
String result = "";
Object obj = args.get(key);
if (obj != null) {
@@ -62,9 +62,9 @@ public class OfbizContentTransform imple
}
return result;
}
-
+
@SuppressWarnings("unchecked")
- public Writer getWriter(final Writer out, Map args) {
+ public Writer getWriter(final Writer out, Map args) {
final StringBuilder buf = new StringBuilder();
final String imgSize = OfbizContentTransform.getArg(args, "variant");
return new Writer(out) {
@@ -87,6 +87,12 @@ public class OfbizContentTransform imple
String requestUrl = buf.toString();
+ // If the URL starts with http(s) then there is nothing for us to do here
+ if (requestUrl.startsWith("http")) {
+ out.write(requestUrl);
+ return;
+ }
+
try {
requestUrl = StringUtil.defaultWebEncoder.decodeFromURL(requestUrl);
} catch (EncodingException e) {
Modified: ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/includes/headerHead.ftl
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/includes/headerHead.ftl?rev=1151030&r1=1151029&r2=1151030&view=diff==============================================================================
--- ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/includes/headerHead.ftl (original)
+++ ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/includes/headerHead.ftl Tue Jul 26 09:06:31 2011
@@ -35,11 +35,7 @@ under the License.
<#list layoutSettings.javaScripts as javaScript>
<#if javaScriptsSet.contains(javaScript)>
<#assign nothing = javaScriptsSet.remove(javaScript)/>
- <#if javaScript?starts_with("http")>
- <script type="text/javascript" src="${StringUtil.wrapString(javaScript)}"></script>
- <#else>
- <script type="text/javascript" src="<@ofbizContentUrl>${StringUtil.wrapString(javaScript)}</@ofbizContentUrl>"></script>
- </#if>
+ <script type="text/javascript" src="<@ofbizContentUrl>${StringUtil.wrapString(javaScript)}</@ofbizContentUrl>"></script>
</#if>
</#list>
</#if>