svn commit: r993489 - in /ofbiz/trunk/framework/webapp: dtd/site-conf.xsd src/org/ofbiz/webapp/control/ConfigXMLReader.java 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: r993489 - in /ofbiz/trunk/framework/webapp: dtd/site-conf.xsd src/org/ofbiz/webapp/control/ConfigXMLReader.java src/org/ofbiz/webapp/control/RequestHandler.java

jonesde
Author: jonesde
Date: Tue Sep  7 19:27:07 2010
New Revision: 993489

URL: http://svn.apache.org/viewvc?rev=993489&view=rev
Log:
For response -> redirect-parameter element added value attribute so you can specify a static value to include in the redirected URL

Modified:
    ofbiz/trunk/framework/webapp/dtd/site-conf.xsd
    ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/ConfigXMLReader.java
    ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/RequestHandler.java

Modified: ofbiz/trunk/framework/webapp/dtd/site-conf.xsd
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webapp/dtd/site-conf.xsd?rev=993489&r1=993488&r2=993489&view=diff
==============================================================================
--- ofbiz/trunk/framework/webapp/dtd/site-conf.xsd (original)
+++ ofbiz/trunk/framework/webapp/dtd/site-conf.xsd Tue Sep  7 19:27:07 2010
@@ -323,6 +323,7 @@ under the License.
                     a request attribute or parameter.</xs:documentation>
             </xs:annotation>
         </xs:attribute>
+        <xs:attribute type="xs:string" name="value" use="optional"/>
     </xs:attributeGroup>
     <xs:element name="view-map">
         <xs:complexType>

Modified: ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/ConfigXMLReader.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/ConfigXMLReader.java?rev=993489&r1=993488&r2=993489&view=diff
==============================================================================
--- ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/ConfigXMLReader.java (original)
+++ ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/ConfigXMLReader.java Tue Sep  7 19:27:07 2010
@@ -596,6 +596,7 @@ public class ConfigXMLReader {
         public boolean saveCurrentView = false;
         public boolean saveHomeView = false;
         public Map<String, String> redirectParameterMap = FastMap.newInstance();
+        public Map<String, String> redirectParameterValueMap = FastMap.newInstance();
 
         public RequestResponse(Element responseElement) {
             this.name = responseElement.getAttribute("name");
@@ -605,9 +606,13 @@ public class ConfigXMLReader {
             this.saveCurrentView = "true".equals(responseElement.getAttribute("save-current-view"));
             this.saveHomeView = "true".equals(responseElement.getAttribute("save-home-view"));
             for (Element redirectParameterElement: UtilXml.childElementList(responseElement, "redirect-parameter")) {
-                String from = redirectParameterElement.getAttribute("from");
-                if (UtilValidate.isEmpty(from)) from = redirectParameterElement.getAttribute("name");
-                this.redirectParameterMap.put(redirectParameterElement.getAttribute("name"), from);
+                if (UtilValidate.isNotEmpty(redirectParameterElement.getAttribute("value"))) {
+                    this.redirectParameterValueMap.put(redirectParameterElement.getAttribute("name"), redirectParameterElement.getAttribute("value"));
+                } else {
+                    String from = redirectParameterElement.getAttribute("from");
+                    if (UtilValidate.isEmpty(from)) from = redirectParameterElement.getAttribute("name");
+                    this.redirectParameterMap.put(redirectParameterElement.getAttribute("name"), from);
+                }
             }
         }
 

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=993489&r1=993488&r2=993489&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 Sep  7 19:27:07 2010
@@ -928,6 +928,19 @@ public class RequestHandler {
                     queryString.append(value);
                 }
             }
+            for (Map.Entry<String, String> entry: requestResponse.redirectParameterValueMap.entrySet()) {
+                String name = entry.getKey();
+                String value = entry.getValue();
+
+                if (UtilValidate.isNotEmpty(value)) {
+                    if (queryString.length() > 1) {
+                        queryString.append("&");
+                    }
+                    queryString.append(name);
+                    queryString.append("=");
+                    queryString.append(value);
+                }
+            }
             return queryString.toString();
         }
     }