struts-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lukaszlen...@apache.org
Subject svn commit: r1459660 - in /struts/struts2/trunk/core/src: main/java/org/apache/struts2/dispatcher/ServletRedirectResult.java test/java/org/apache/struts2/dispatcher/ServletRedirectResultTest.java
Date Fri, 22 Mar 2013 08:05:36 GMT
Author: lukaszlenart
Date: Fri Mar 22 08:05:36 2013
New Revision: 1459660

URL: http://svn.apache.org/r1459660
Log:
WW-3389 Adds statusCode param as a excluded param to hide it in built url

Modified:
    struts/struts2/trunk/core/src/main/java/org/apache/struts2/dispatcher/ServletRedirectResult.java
    struts/struts2/trunk/core/src/test/java/org/apache/struts2/dispatcher/ServletRedirectResultTest.java

Modified: struts/struts2/trunk/core/src/main/java/org/apache/struts2/dispatcher/ServletRedirectResult.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/java/org/apache/struts2/dispatcher/ServletRedirectResult.java?rev=1459660&r1=1459659&r2=1459660&view=diff
==============================================================================
--- struts/struts2/trunk/core/src/main/java/org/apache/struts2/dispatcher/ServletRedirectResult.java
(original)
+++ struts/struts2/trunk/core/src/main/java/org/apache/struts2/dispatcher/ServletRedirectResult.java
Fri Mar 22 08:05:36 2013
@@ -198,8 +198,9 @@ public class ServletRedirectResult exten
             if (resultConfig != null) {
                 Map<String, String> resultConfigParams = resultConfig.getParams();
 
+                List<String> prohibitedResultParams = getProhibitedResultParams();
                 for (Map.Entry<String, String> e : resultConfigParams.entrySet()) {
-                    if (!getProhibitedResultParams().contains(e.getKey())) {
+                    if (!prohibitedResultParams.contains(e.getKey())) {
                         String potentialValue = e.getValue() == null ? "" : conditionalParse(e.getValue(),
invocation);
                         if (!suppressEmptyParameters || ((potentialValue != null) &&
(potentialValue.length() > 0))) {
                             requestParameters.put(e.getKey(), potentialValue);
@@ -227,7 +228,18 @@ public class ServletRedirectResult exten
     }
 
     protected List<String> getProhibitedResultParams() {
-        return Arrays.asList(DEFAULT_PARAM, "namespace", "method", "encode", "parse", "location",
"prependServletContext", "suppressEmptyParameters", "anchor");
+        return Arrays.asList(
+                DEFAULT_PARAM,
+                "namespace",
+                "method",
+                "encode",
+                "parse",
+                "location",
+                "prependServletContext",
+                "suppressEmptyParameters",
+                "anchor",
+                "statusCode"
+        );
     }
 
     /**

Modified: struts/struts2/trunk/core/src/test/java/org/apache/struts2/dispatcher/ServletRedirectResultTest.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/test/java/org/apache/struts2/dispatcher/ServletRedirectResultTest.java?rev=1459660&r1=1459659&r2=1459660&view=diff
==============================================================================
--- struts/struts2/trunk/core/src/test/java/org/apache/struts2/dispatcher/ServletRedirectResultTest.java
(original)
+++ struts/struts2/trunk/core/src/test/java/org/apache/struts2/dispatcher/ServletRedirectResultTest.java
Fri Mar 22 08:05:36 2013
@@ -183,6 +183,7 @@ public class ServletRedirectResultTest e
             .addParam("location", "someLocation")
             .addParam("prependServletContext", "true")
             .addParam("method", "someMethod")
+            .addParam("statusCode", "333")
             .addParam("param1", "value 1")
             .addParam("param2", "value 2")
             .addParam("param3", "value 3")
@@ -221,7 +222,6 @@ public class ServletRedirectResultTest e
         result.setActionMapper(container.getInstance(ActionMapper.class));
         result.execute(mockInvocation);
         assertEquals("/myNamespace/myAction.action?param1=value+1&param2=value+2&param3=value+3#fragment",
res.getRedirectedUrl());
-
         control.verify();
     }
 



Mime
View raw message