Author: sascharodekamp
Date: Thu Mar 8 16:15:25 2012
New Revision: 1298454
URL:
http://svn.apache.org/viewvc?rev=1298454&view=revLog:
No Url encoding for get parameters (
https://issues.apache.org/jira/browse/OFBIZ-2628) using the URLEncoder to encode and render URLs with special Chars. The encoding is always UTF-8. Fixed Patch without the HTTPS redirect bug.
Modified:
ofbiz/trunk/framework/widget/src/org/ofbiz/widget/WidgetWorker.java
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=1298454&r1=1298453&r2=1298454&view=diff==============================================================================
--- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/WidgetWorker.java (original)
+++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/WidgetWorker.java Thu Mar 8 16:15:25 2012
@@ -20,7 +20,10 @@ package org.ofbiz.widget;
import java.io.IOException;
import java.io.StringWriter;
+import java.io.UnsupportedEncodingException;
import java.math.BigDecimal;
+import java.net.URLEncoder;
+import java.nio.charset.Charset;
import java.text.DateFormat;
import java.util.Map;
import java.util.TimeZone;
@@ -339,7 +342,12 @@ public class WidgetWorker {
public String getValue(Map<String, Object> context) {
if (this.value != null) {
- return this.value.expandString(context);
+ try {
+ return URLEncoder.encode(this.value.expandString(context), Charset.forName("UTF-8").displayName());
+ } catch (UnsupportedEncodingException e) {
+ Debug.logError(e, module);
+ return this.value.expandString(context);
+ }
}
Object retVal = null;
@@ -370,7 +378,11 @@ public class WidgetWorker {
DateFormat df = UtilDateTime.toDateTimeFormat("EEE MMM dd hh:mm:ss z yyyy", timeZone, null);
returnValue = df.format((java.util.Date) retVal);
} else {
- returnValue = retVal.toString();
+ try {
+ returnValue = URLEncoder.encode(retVal.toString(), Charset.forName("UTF-8").displayName());
+ } catch (UnsupportedEncodingException e) {
+ Debug.logError(e, module);
+ }
}
return returnValue;
} else {