struts-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lukaszlen...@apache.org
Subject [struts] branch support-2-3 updated: Avoids parsing namespace when using existing namespace
Date Tue, 08 May 2018 06:48:47 GMT
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 <lukaszlenart@apache.org>
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<PortletMode, String> 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.

Mime
View raw message