Avoids parsing namespace when using existing namespace

This commit is contained in:
Lukasz Lenart
2018-05-02 08:04:15 +02:00
parent 2a9fc1ace9
commit 2877a656e0
5 changed files with 9 additions and 7 deletions
@@ -201,13 +201,10 @@ public class ActionChainResult implements Result {
* @param invocation the DefaultActionInvocation calling the action call stack
*/
public void execute(ActionInvocation invocation) throws Exception {
// if the finalNamespace wasn't explicitly defined, assume the current one
if (this.namespace == null) {
this.namespace = invocation.getProxy().getNamespace();
}
ValueStack stack = ActionContext.getContext().getValueStack();
String finalNamespace = TextParseUtil.translateVariables(namespace, stack);
String finalNamespace = this.namespace != null
? TextParseUtil.translateVariables(namespace, stack)
: invocation.getProxy().getNamespace();
String finalActionName = TextParseUtil.translateVariables(actionName, stack);
String finalMethodName = this.methodName != null
? TextParseUtil.translateVariables(this.methodName, stack)
@@ -136,6 +136,7 @@ public class PostbackResult extends StrutsResultSupport {
actionName = conditionalParse(actionName, invocation);
if (namespace == null) {
namespace = invocation.getProxy().getNamespace();
parseLocation = false;
} else {
namespace = conditionalParse(namespace, invocation);
}
@@ -161,6 +161,7 @@ public class ServletActionRedirectResult extends ServletRedirectResult implement
actionName = conditionalParse(actionName, invocation);
if (namespace == null) {
namespace = invocation.getProxy().getNamespace();
parseLocation = false;
} else {
namespace = conditionalParse(namespace, invocation);
}
@@ -122,6 +122,8 @@ public abstract class StrutsResultSupport implements Result, StrutsStatics {
/** use UTF-8 as this is the recommended encoding by W3C to avoid incompatibilities. */
public static final String DEFAULT_URL_ENCODING = "UTF-8";
protected boolean parseLocation = true;
private boolean parse;
private boolean encode;
private String location;
@@ -200,7 +202,7 @@ public abstract class StrutsResultSupport implements Result, StrutsStatics {
* @throws Exception if an error occurs while executing the result.
*/
public void execute(ActionInvocation invocation) throws Exception {
lastFinalLocation = conditionalParse(location, invocation);
lastFinalLocation = parseLocation ? conditionalParse(location, invocation) : location;
doExecute(lastFinalLocation, invocation);
}
@@ -179,6 +179,7 @@ public class PortletActionRedirectResult extends PortletResult {
}
if (namespace == null) {
namespace = invocation.getProxy().getNamespace();
parseLocation = false;
} else {
namespace = conditionalParse(namespace, invocation);
}