You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by jo...@apache.org on 2009/02/14 22:50:44 UTC

svn commit: r744573 - in /ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp: control/LoginWorker.java ftl/OfbizContentTransform.java ftl/OfbizUrlTransform.java

Author: jonesde
Date: Sat Feb 14 21:50:43 2009
New Revision: 744573

URL: http://svn.apache.org/viewvc?rev=744573&view=rev
Log:
Changed these back to have LoginWorker.makeLoginUrl return a StringWrapper so it doesn't get encoded, and the @ofbizUrl and @ofbizContentUrl tags back to not decode because it is important that various encoded parameters remain encoded so the browser does not interpret the characters as part of the URL

Modified:
    ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/LoginWorker.java
    ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/ftl/OfbizContentTransform.java
    ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/ftl/OfbizUrlTransform.java

Modified: ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/LoginWorker.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/LoginWorker.java?rev=744573&r1=744572&r2=744573&view=diff
==============================================================================
--- ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/LoginWorker.java (original)
+++ ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/LoginWorker.java Sat Feb 14 21:50:43 2009
@@ -42,11 +42,13 @@
 import org.ofbiz.base.util.Debug;
 import org.ofbiz.base.util.GeneralException;
 import org.ofbiz.base.util.KeyStoreUtil;
+import org.ofbiz.base.util.StringUtil;
 import org.ofbiz.base.util.UtilFormatOut;
 import org.ofbiz.base.util.UtilHttp;
 import org.ofbiz.base.util.UtilMisc;
 import org.ofbiz.base.util.UtilProperties;
 import org.ofbiz.base.util.UtilValidate;
+import org.ofbiz.base.util.StringUtil.StringWrapper;
 import org.ofbiz.common.login.LoginServices;
 import org.ofbiz.entity.GenericDelegator;
 import org.ofbiz.entity.GenericEntityException;
@@ -78,25 +80,25 @@
     /** This Map is keyed by the randomly generated externalLoginKey and the value is a UserLogin GenericValue object */
     public static Map<String, GenericValue> externalLoginKeys = FastMap.newInstance();
     
-    public static String makeLoginUrl(PageContext pageContext) {
+    public static StringWrapper makeLoginUrl(PageContext pageContext) {
         return makeLoginUrl(pageContext, "checkLogin");
     }
 
-    public static String makeLoginUrl(HttpServletRequest request) {
+    public static StringWrapper makeLoginUrl(HttpServletRequest request) {
         return makeLoginUrl(request, "checkLogin");
     }
     
-    public static String makeLoginUrl(PageContext pageContext, String requestName) {
+    public static StringWrapper makeLoginUrl(PageContext pageContext, String requestName) {
         return makeLoginUrl((HttpServletRequest) pageContext.getRequest(), requestName);
     }
-    public static String makeLoginUrl(HttpServletRequest request, String requestName) {
+    public static StringWrapper makeLoginUrl(HttpServletRequest request, String requestName) {
         Map<String, Object> urlParams = UtilHttp.getUrlOnlyParameterMap(request);
         String queryString = UtilHttp.urlEncodeArgs(urlParams, false);
         String currentView = UtilFormatOut.checkNull((String) request.getAttribute("_CURRENT_VIEW_"));
 
         String loginUrl = "/" + requestName;
         if ("login".equals(currentView)) {
-            return loginUrl;
+            return StringUtil.wrapString(loginUrl);
         }
         if (UtilValidate.isNotEmpty(currentView)) {
             loginUrl += "/" + currentView;
@@ -105,8 +107,7 @@
             loginUrl += "?" + queryString;
         }
 
-        //return StringUtil.wrapString(loginUrl);
-        return loginUrl;
+        return StringUtil.wrapString(loginUrl);
     }
     
     /**

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=744573&r1=744572&r2=744573&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 Sat Feb 14 21:50:43 2009
@@ -59,12 +59,6 @@
                     HttpServletRequest request = req == null ? null : (HttpServletRequest) req.getWrappedObject();
                     
                     String requestUrl = buf.toString();
-                    // just in case the request is encoded, decode before making the link
-                    try {
-                        requestUrl = StringUtil.defaultWebEncoder.decodeFromURL(requestUrl);
-                    } catch (EncodingException e) {
-                        Debug.logError(e, "Error decoding URL string [" + requestUrl + "]: " + e.toString(), module);
-                    }
                     
                     // make the link
                     StringBuffer newURL = new StringBuffer();

Modified: ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/ftl/OfbizUrlTransform.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/ftl/OfbizUrlTransform.java?rev=744573&r1=744572&r2=744573&view=diff
==============================================================================
--- ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/ftl/OfbizUrlTransform.java (original)
+++ ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/ftl/OfbizUrlTransform.java Sat Feb 14 21:50:43 2009
@@ -88,12 +88,6 @@
                         }
                         
                         String requestUrl = buf.toString();
-                        // just in case the request is encoded, decode before making the link
-                        try {
-                            requestUrl = StringUtil.defaultWebEncoder.decodeFromURL(requestUrl);
-                        } catch (EncodingException e) {
-                            Debug.logError(e, "Error decoding URL string [" + requestUrl + "]: " + e.toString(), module);
-                        }
                         
                         // make the link
                         RequestHandler rh = (RequestHandler) ctx.getAttribute("_REQUEST_HANDLER_");