From commits-return-17894-archive-asf-public=cust-asf.ponee.io@struts.apache.org Tue May 8 08:48:50 2018 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx-eu-01.ponee.io (Postfix) with SMTP id AB92B18063B for ; Tue, 8 May 2018 08:48:49 +0200 (CEST) Received: (qmail 97606 invoked by uid 500); 8 May 2018 06:48:48 -0000 Mailing-List: contact commits-help@struts.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@struts.apache.org Delivered-To: mailing list commits@struts.apache.org Received: (qmail 97597 invoked by uid 99); 8 May 2018 06:48:48 -0000 Received: from ec2-52-202-80-70.compute-1.amazonaws.com (HELO gitbox.apache.org) (52.202.80.70) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 08 May 2018 06:48:48 +0000 Received: by gitbox.apache.org (ASF Mail Server at gitbox.apache.org, from userid 33) id C9F66807B8; Tue, 8 May 2018 06:48:47 +0000 (UTC) Date: Tue, 08 May 2018 06:48:47 +0000 To: "commits@struts.apache.org" Subject: [struts] branch support-2-3 updated: Avoids parsing namespace when using existing namespace MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Message-ID: <152576212775.22297.5327462633283816681@gitbox.apache.org> From: lukaszlenart@apache.org X-Git-Host: gitbox.apache.org X-Git-Repo: struts X-Git-Refname: refs/heads/support-2-3 X-Git-Reftype: branch X-Git-Oldrev: a746fc872acbe8d14057c56bcffda468be94a87e X-Git-Newrev: 4a3917176de2df7f33a85511d067f31e50dcc1b2 X-Git-Rev: 4a3917176de2df7f33a85511d067f31e50dcc1b2 X-Git-NotificationType: ref_changed_plus_diff X-Git-Multimail-Version: 1.5.dev Auto-Submitted: auto-generated This is an automated email from the ASF dual-hosted git repository. lukaszlenart pushed a commit to branch support-2-3 in repository https://gitbox.apache.org/repos/asf/struts.git The following commit(s) were added to refs/heads/support-2-3 by this push: new 4a39171 Avoids parsing namespace when using existing namespace 4a39171 is described below commit 4a3917176de2df7f33a85511d067f31e50dcc1b2 Author: Lukasz Lenart AuthorDate: Tue May 8 07:58:34 2018 +0200 Avoids parsing namespace when using existing namespace --- .../java/org/apache/struts2/dispatcher/PostbackResult.java | 2 ++ .../struts2/dispatcher/ServletActionRedirectResult.java | 2 ++ .../org/apache/struts2/dispatcher/StrutsResultSupport.java | 4 +++- .../struts2/portlet/result/PortletActionRedirectResult.java | 2 ++ .../java/com/opensymphony/xwork2/ActionChainResult.java | 13 +++++-------- 5 files changed, 14 insertions(+), 9 deletions(-) diff --git a/core/src/main/java/org/apache/struts2/dispatcher/PostbackResult.java b/core/src/main/java/org/apache/struts2/dispatcher/PostbackResult.java index 89e3400..f6a81e4 100644 --- a/core/src/main/java/org/apache/struts2/dispatcher/PostbackResult.java +++ b/core/src/main/java/org/apache/struts2/dispatcher/PostbackResult.java @@ -127,6 +127,8 @@ public class PostbackResult extends StrutsResultSupport { if (actionName != null) { actionName = conditionalParse(actionName, invocation); + parseLocation = false; + if (namespace == null) { namespace = invocation.getProxy().getNamespace(); } else { diff --git a/core/src/main/java/org/apache/struts2/dispatcher/ServletActionRedirectResult.java b/core/src/main/java/org/apache/struts2/dispatcher/ServletActionRedirectResult.java index 5e0f835..baaf4ae 100644 --- a/core/src/main/java/org/apache/struts2/dispatcher/ServletActionRedirectResult.java +++ b/core/src/main/java/org/apache/struts2/dispatcher/ServletActionRedirectResult.java @@ -164,6 +164,8 @@ public class ServletActionRedirectResult extends ServletRedirectResult implement */ public void execute(ActionInvocation invocation) throws Exception { actionName = conditionalParse(actionName, invocation); + parseLocation = false; + if (namespace == null) { namespace = invocation.getProxy().getNamespace(); } else { diff --git a/core/src/main/java/org/apache/struts2/dispatcher/StrutsResultSupport.java b/core/src/main/java/org/apache/struts2/dispatcher/StrutsResultSupport.java index bbcffa3..930c088 100644 --- a/core/src/main/java/org/apache/struts2/dispatcher/StrutsResultSupport.java +++ b/core/src/main/java/org/apache/struts2/dispatcher/StrutsResultSupport.java @@ -118,6 +118,8 @@ public abstract class StrutsResultSupport implements Result, StrutsStatics { private String location; private String lastFinalLocation; + protected boolean parseLocation = true; + public StrutsResultSupport() { this(null, true, false); } @@ -187,7 +189,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); } diff --git a/plugins/portlet/src/main/java/org/apache/struts2/portlet/result/PortletActionRedirectResult.java b/plugins/portlet/src/main/java/org/apache/struts2/portlet/result/PortletActionRedirectResult.java index 04729c1..ce7c02b 100644 --- a/plugins/portlet/src/main/java/org/apache/struts2/portlet/result/PortletActionRedirectResult.java +++ b/plugins/portlet/src/main/java/org/apache/struts2/portlet/result/PortletActionRedirectResult.java @@ -174,6 +174,8 @@ public class PortletActionRedirectResult extends PortletResult { */ public void execute(ActionInvocation invocation) throws Exception { actionName = conditionalParse(actionName, invocation); + parseLocation = false; + String portletNamespace = (String)invocation.getInvocationContext().get(PortletConstants.PORTLET_NAMESPACE); if (portletMode != null) { Map namespaceMap = getNamespaceMap(invocation); diff --git a/xwork-core/src/main/java/com/opensymphony/xwork2/ActionChainResult.java b/xwork-core/src/main/java/com/opensymphony/xwork2/ActionChainResult.java index 170c567..9aeb0de 100644 --- a/xwork-core/src/main/java/com/opensymphony/xwork2/ActionChainResult.java +++ b/xwork-core/src/main/java/com/opensymphony/xwork2/ActionChainResult.java @@ -197,17 +197,14 @@ 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) - : null; + ? TextParseUtil.translateVariables(this.methodName, stack) + : null; if (isInChainHistory(finalNamespace, finalActionName, finalMethodName)) { addToHistory(finalNamespace, finalActionName, finalMethodName); -- To stop receiving notification emails like this one, please contact lukaszlenart@apache.org.