You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@struts.apache.org by jo...@apache.org on 2011/05/22 19:15:55 UTC
svn commit: r1126101 - in /struts/struts2/trunk:
core/src/main/java/org/apache/struts2/components/
xwork-core/src/main/java/com/opensymphony/xwork2/
xwork-core/src/main/java/com/opensymphony/xwork2/mock/
Author: jogep
Date: Sun May 22 17:15:55 2011
New Revision: 1126101
URL: http://svn.apache.org/viewvc?rev=1126101&view=rev
Log:
WW-3628 : Regression in s:url tag action's method is no longer being included in the resultant url
Patch by Jason Pyeron
Modified:
struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/ServletUrlRenderer.java
struts/struts2/trunk/xwork-core/src/main/java/com/opensymphony/xwork2/ActionProxy.java
struts/struts2/trunk/xwork-core/src/main/java/com/opensymphony/xwork2/DefaultActionProxy.java
struts/struts2/trunk/xwork-core/src/main/java/com/opensymphony/xwork2/mock/MockActionProxy.java
Modified: struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/ServletUrlRenderer.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/ServletUrlRenderer.java?rev=1126101&r1=1126100&r2=1126101&view=diff
==============================================================================
--- struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/ServletUrlRenderer.java (original)
+++ struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/ServletUrlRenderer.java Sun May 22 17:15:55 2011
@@ -77,7 +77,8 @@ public class ServletUrlRenderer implemen
final String action = ai.getProxy().getActionName();
final String namespace = ai.getProxy().getNamespace();
- result = urlComponent.determineActionURL(action, namespace, urlComponent.getMethod(),urlComponent.getHttpServletRequest(), urlComponent.getHttpServletResponse(), urlComponent.getParameters(), scheme, urlComponent.isIncludeContext(), urlComponent.isEncode(), urlComponent.isForceAddSchemeHostAndPort(), urlComponent.isEscapeAmp());
+ final String method = urlComponent.getMethod() != null || !ai.getProxy().isMethodSpecified() ? urlComponent.getMethod() : ai.getProxy().getMethod();
+ result = urlComponent.determineActionURL(action, namespace, method, urlComponent.getHttpServletRequest(), urlComponent.getHttpServletResponse(), urlComponent.getParameters(), scheme, urlComponent.isIncludeContext(), urlComponent.isEncode(), urlComponent.isForceAddSchemeHostAndPort(), urlComponent.isEscapeAmp());
} else {
String _value = urlComponent.getValue();
Modified: struts/struts2/trunk/xwork-core/src/main/java/com/opensymphony/xwork2/ActionProxy.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/xwork-core/src/main/java/com/opensymphony/xwork2/ActionProxy.java?rev=1126101&r1=1126100&r2=1126101&view=diff
==============================================================================
--- struts/struts2/trunk/xwork-core/src/main/java/com/opensymphony/xwork2/ActionProxy.java (original)
+++ struts/struts2/trunk/xwork-core/src/main/java/com/opensymphony/xwork2/ActionProxy.java Sun May 22 17:15:55 2011
@@ -92,5 +92,12 @@ public interface ActionProxy {
* @return the method to execute
*/
String getMethod();
+
+ /**
+ * Gets status of the method value's initialization.
+ *
+ * @return true if the method returned by getMethod() is not a default initializer value.
+ */
+ boolean isMethodSpecified();
}
Modified: struts/struts2/trunk/xwork-core/src/main/java/com/opensymphony/xwork2/DefaultActionProxy.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/xwork-core/src/main/java/com/opensymphony/xwork2/DefaultActionProxy.java?rev=1126101&r1=1126100&r2=1126101&view=diff
==============================================================================
--- struts/struts2/trunk/xwork-core/src/main/java/com/opensymphony/xwork2/DefaultActionProxy.java (original)
+++ struts/struts2/trunk/xwork-core/src/main/java/com/opensymphony/xwork2/DefaultActionProxy.java Sun May 22 17:15:55 2011
@@ -60,6 +60,8 @@ public class DefaultActionProxy implemen
protected ActionEventListener actionEventListener;
+ private boolean methodSpecified=true;
+
/**
* This constructor is private so the builder methods (create*) should be used to create an DefaultActionProxy.
* <p/>
@@ -162,6 +164,7 @@ public class DefaultActionProxy implemen
if (StringUtils.isEmpty(this.method)) {
this.method = "execute";
}
+ methodSpecified=false;
}
}
@@ -201,4 +204,10 @@ public class DefaultActionProxy implemen
UtilTimerStack.pop(profileKey);
}
}
+
+ @Override
+ public boolean isMethodSpecified()
+ {
+ return methodSpecified;
+ }
}
Modified: struts/struts2/trunk/xwork-core/src/main/java/com/opensymphony/xwork2/mock/MockActionProxy.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/xwork-core/src/main/java/com/opensymphony/xwork2/mock/MockActionProxy.java?rev=1126101&r1=1126100&r2=1126101&view=diff
==============================================================================
--- struts/struts2/trunk/xwork-core/src/main/java/com/opensymphony/xwork2/mock/MockActionProxy.java (original)
+++ struts/struts2/trunk/xwork-core/src/main/java/com/opensymphony/xwork2/mock/MockActionProxy.java Sun May 22 17:15:55 2011
@@ -38,6 +38,7 @@ public class MockActionProxy implements
boolean executedCalled;
String returnedResult;
Configuration configuration;
+ boolean methodSpecified;
public void prepare() throws Exception {}
@@ -109,6 +110,17 @@ public class MockActionProxy implements
public void setMethod(String method) {
this.method = method;
+ methodSpecified=method!=null && !"".equals(method);
+ }
+
+ public boolean isMethodSpecified()
+ {
+ return methodSpecified;
+ }
+
+ public void setMethodSpecified(boolean methodSpecified)
+ {
+ this.methodSpecified = methodSpecified;
}
}