mirror of
https://github.com/apache/struts.git
synced 2026-08-07 15:46:57 +00:00
WW-3389 Adds statusCode param as a excluded param to hide it in built url
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@1459660 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
@@ -198,8 +198,9 @@ public class ServletRedirectResult extends StrutsResultSupport implements Reflec
|
||||
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 extends StrutsResultSupport implements Reflec
|
||||
}
|
||||
|
||||
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"
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -183,6 +183,7 @@ public class ServletRedirectResultTest extends StrutsTestCase implements StrutsS
|
||||
.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 extends StrutsTestCase implements StrutsS
|
||||
result.setActionMapper(container.getInstance(ActionMapper.class));
|
||||
result.execute(mockInvocation);
|
||||
assertEquals("/myNamespace/myAction.action?param1=value+1¶m2=value+2¶m3=value+3#fragment", res.getRedirectedUrl());
|
||||
|
||||
control.verify();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user