svn commit: r1040044 - /ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/RequestHandler.java

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit: r1040044 - /ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/RequestHandler.java

jleroux@apache.org
Author: jleroux
Date: Mon Nov 29 09:33:39 2010
New Revision: 1040044

URL: http://svn.apache.org/viewvc?rev=1040044&view=rev
Log:
A patch from Sascha Rodekamp "Redirect from Http to Https causes double service call" (https://issues.apache.org/jira/browse/OFBIZ-3988) - OFBIZ-3988

The problem is, when you call a request over http, but the controller wants an https request, the RequestHandler make an redirect to https (which is indeed pretty cool). But this redirect causes that Events/ Services will be called twice. This can be avoided when we return from the Service/ Event directly after doing the redirect.
Example: http://localhost:8080/ecommerce/control/setdistributor?distributor=4711

Modified:
    ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/RequestHandler.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=1040044&r1=1040043&r2=1040044&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 Mon Nov 29 09:33:39 2010
@@ -221,6 +221,7 @@ public class RequestHandler {
                     if (newUrl.toUpperCase().startsWith("HTTPS")) {
                         // if we are supposed to be secure, redirect secure.
                         callRedirect(newUrl, response, request);
+                        return;
                     }
                 }
             // if this is a new session and forceHttpSession is true and the request is secure but does not
@@ -235,6 +236,7 @@ public class RequestHandler {
                 String newUrl = RequestHandler.makeUrl(request, response, urlBuf.toString(), true, false, false);
                 if (newUrl.toUpperCase().startsWith("HTTP")) {
                     callRedirect(newUrl, response, request);
+                    return;
                 }
             }