Author: sascharodekamp
Date: Tue Mar 6 12:24:12 2012 New Revision: 1297443 URL: http://svn.apache.org/viewvc?rev=1297443&view=rev Log: Revert r1297006 because the encoding makes a problem with redirecting from HTTP to HTTPS Modified: ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/RequestHandler.java ofbiz/trunk/framework/widget/src/org/ofbiz/widget/WidgetWorker.java Modified: ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/RequestHandler.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/RequestHandler.java?rev=1297443&r1=1297442&r2=1297443&view=diff ============================================================================== --- ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/RequestHandler.java (original) +++ ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/RequestHandler.java Tue Mar 6 12:24:12 2012 @@ -24,8 +24,6 @@ import java.io.IOException; import java.io.Serializable; import java.io.UnsupportedEncodingException; import java.net.URL; -import java.net.URLEncoder; -import java.nio.charset.Charset; import java.security.cert.X509Certificate; import java.util.Enumeration; import java.util.List; @@ -141,7 +139,7 @@ public class RequestHandler { requestMap = requestMapMap.get(defaultRequest); } } - + // check for override view if (overrideViewUri != null) { ConfigXMLReader.ViewMap viewMap = getControllerConfig().getViewMapMap().get(overrideViewUri); @@ -152,7 +150,7 @@ public class RequestHandler { } } } - + // still not found so stop if (requestMap == null) { throw new RequestHandlerException(requestMissingErrorMessage); @@ -930,7 +928,7 @@ public class RequestHandler { * @return return the query string */ public String makeQueryString(HttpServletRequest request, ConfigXMLReader.RequestResponse requestResponse) { - if (requestResponse == null || + if (requestResponse == null || (requestResponse.redirectParameterMap.size() == 0 && requestResponse.redirectParameterValueMap.size() == 0)) { Map<String, Object> urlParams = UtilHttp.getUrlOnlyParameterMap(request); String queryString = UtilHttp.urlEncodeArgs(urlParams, false); @@ -1116,12 +1114,7 @@ public class RequestHandler { } } - try { - encodedUrl = URLEncoder.encode(newURL.toString(), Charset.forName("UTF-8").displayName()); - } catch (UnsupportedEncodingException e) { - Debug.logError(e, module); - encodedUrl = newURL.toString(); - } + encodedUrl = newURL.toString(); } } else { encodedUrl = newURL.toString(); 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=1297443&r1=1297442&r2=1297443&view=diff ============================================================================== --- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/WidgetWorker.java (original) +++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/WidgetWorker.java Tue Mar 6 12:24:12 2012 @@ -20,10 +20,7 @@ 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; @@ -107,10 +104,10 @@ public class WidgetWorker { parameterValue = parameter.getValue(); } else { Object parameterObject = parameter.getValue(); - + // skip null values if (parameterObject == null) continue; - + if (parameterObject instanceof String[]) { // it's probably a String[], just get the first value String[] parameterArray = (String[]) parameterObject; @@ -121,7 +118,7 @@ public class WidgetWorker { parameterValue = parameterObject.toString(); } } - + if (needsAmp) { externalWriter.append("&"); } else { @@ -342,14 +339,9 @@ public class WidgetWorker { public String getValue(Map<String, Object> context) { if (this.value != null) { - 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); - } + return this.value.expandString(context); } - + Object retVal = null; if (this.fromField != null && this.fromField.get(context) != null) { retVal = this.fromField.get(context); @@ -360,7 +352,7 @@ public class WidgetWorker { if (retVal != null) { TimeZone timeZone = (TimeZone) context.get("timeZone"); if (timeZone == null) timeZone = TimeZone.getDefault(); - + String returnValue = null; // format string based on the user's time zone (not locale because these are parameters) if (retVal instanceof Double || retVal instanceof Float || retVal instanceof BigDecimal) { @@ -378,11 +370,7 @@ 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 { - try { - returnValue = URLEncoder.encode(retVal.toString(), Charset.forName("UTF-8").displayName()); - } catch (UnsupportedEncodingException e) { - Debug.logError(e, module); - } + returnValue = retVal.toString(); } return returnValue; } else { @@ -413,7 +401,7 @@ public class WidgetWorker { /** Returns the script location based on a script combined name: * <code>location#methodName</code>. - * + * * @param combinedName The combined location/method name * @return The script location */ @@ -428,7 +416,7 @@ public class WidgetWorker { /** Returns the script method name based on a script combined name: * <code>location#methodName</code>. Returns <code>null</code> if * no method name is found. - * + * * @param combinedName The combined location/method name * @return The method name or <code>null</code> */ |
Free forum by Nabble | Edit this page |