You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@struts.apache.org by pb...@apache.org on 2007/07/22 05:33:54 UTC
svn commit: r558457 - in /struts/struts1/trunk/core/src/main:
java/org/apache/struts/action/ActionServlet.java
java/org/apache/struts/config/ActionConfig.java
resources/org/apache/struts/resources/struts-config_1_4.dtd
Author: pbenedict
Date: Sat Jul 21 20:33:53 2007
New Revision: 558457
URL: http://svn.apache.org/viewvc?view=rev&rev=558457
Log:
STR-3078: action configs to also extend by actionId
Modified:
struts/struts1/trunk/core/src/main/java/org/apache/struts/action/ActionServlet.java
struts/struts1/trunk/core/src/main/java/org/apache/struts/config/ActionConfig.java
struts/struts1/trunk/core/src/main/resources/org/apache/struts/resources/struts-config_1_4.dtd
Modified: struts/struts1/trunk/core/src/main/java/org/apache/struts/action/ActionServlet.java
URL: http://svn.apache.org/viewvc/struts/struts1/trunk/core/src/main/java/org/apache/struts/action/ActionServlet.java?view=diff&rev=558457&r1=558456&r2=558457
==============================================================================
--- struts/struts1/trunk/core/src/main/java/org/apache/struts/action/ActionServlet.java (original)
+++ struts/struts1/trunk/core/src/main/java/org/apache/struts/action/ActionServlet.java Sat Jul 21 20:33:53 2007
@@ -1468,7 +1468,10 @@
// Make sure that this config is of the right class
ActionConfig baseConfig = moduleConfig.findActionConfig(ancestor);
-
+ if (baseConfig == null) {
+ baseConfig = moduleConfig.findActionConfigId(ancestor);
+ }
+
if (baseConfig == null) {
throw new UnavailableException("Unable to find "
+ "action config for '" + ancestor + "' to extend.");
Modified: struts/struts1/trunk/core/src/main/java/org/apache/struts/config/ActionConfig.java
URL: http://svn.apache.org/viewvc/struts/struts1/trunk/core/src/main/java/org/apache/struts/config/ActionConfig.java?view=diff&rev=558457&r1=558456&r2=558457
==============================================================================
--- struts/struts1/trunk/core/src/main/java/org/apache/struts/config/ActionConfig.java (original)
+++ struts/struts1/trunk/core/src/main/java/org/apache/struts/config/ActionConfig.java Sat Jul 21 20:33:53 2007
@@ -385,22 +385,24 @@
}
/**
- * <p>Returns the path of the ActionConfig that this object should inherit
- * properties from.</p>
+ * <p>Returns the <code>path</code> or <code>actionId</code> of the
+ * <code>ActionConfig</code> that this object should inherit properties
+ * from.</p>
*
- * @return the path of the ActionConfig that this object should inherit
- * properties from.
+ * @return the path or action id of the action mapping that this object
+ * should inherit properties from.
*/
public String getExtends() {
return (this.inherit);
}
/**
- * <p>Set the path of the ActionConfig that this object should inherit
- * properties from.</p>
+ * <p>Set the <code>path</code> or <code>actionId</code> of the
+ * <code>ActionConfig</code> that this object should inherit properties
+ * from.</p>
*
- * @param inherit the path of the ActionConfig that this object should
- * inherit properties from.
+ * @param inherit the path or action id of the action mapping that this
+ * object should inherit properties from.
*/
public void setExtends(String inherit) {
if (configured) {
@@ -882,21 +884,24 @@
* @return true if circular inheritance was detected.
*/
protected boolean checkCircularInheritance(ModuleConfig moduleConfig) {
- String ancestorPath = getExtends();
+ String ancestor = getExtends();
- while (ancestorPath != null) {
- // check if we have the same path as an ancestor
- if (getPath().equals(ancestorPath)) {
+ while (ancestor != null) {
+ // check if we have the same path or id as an ancestor
+ if (getPath().equals(ancestor) || ancestor.equals(getActionId())) {
return true;
}
- // get our ancestor's ancestor
- ActionConfig ancestor = moduleConfig.findActionConfig(ancestorPath);
+ // get our ancestor's config
+ ActionConfig baseConfig = moduleConfig.findActionConfig(ancestor);
+ if (baseConfig == null) {
+ baseConfig = moduleConfig.findActionConfigId(ancestor);
+ }
- if (ancestor != null) {
- ancestorPath = ancestor.getExtends();
+ if (baseConfig != null) {
+ ancestor = baseConfig.getExtends();
} else {
- ancestorPath = null;
+ ancestor = null;
}
}
@@ -1249,15 +1254,18 @@
throw new IllegalStateException("Configuration is frozen");
}
- String ancestorPath = getExtends();
+ String ancestor = getExtends();
- if ((!extensionProcessed) && (ancestorPath != null)) {
+ if ((!extensionProcessed) && (ancestor != null)) {
ActionConfig baseConfig =
- moduleConfig.findActionConfig(ancestorPath);
-
+ moduleConfig.findActionConfig(ancestor);
+ if (baseConfig == null) {
+ baseConfig = moduleConfig.findActionConfigId(ancestor);
+ }
+
if (baseConfig == null) {
throw new NullPointerException("Unable to find "
- + "action for '" + ancestorPath + "' to extend.");
+ + "action for '" + ancestor + "' to extend.");
}
// Check against circular inheritance and make sure the base
Modified: struts/struts1/trunk/core/src/main/resources/org/apache/struts/resources/struts-config_1_4.dtd
URL: http://svn.apache.org/viewvc/struts/struts1/trunk/core/src/main/resources/org/apache/struts/resources/struts-config_1_4.dtd?view=diff&rev=558457&r1=558456&r2=558457
==============================================================================
--- struts/struts1/trunk/core/src/main/resources/org/apache/struts/resources/struts-config_1_4.dtd (original)
+++ struts/struts1/trunk/core/src/main/resources/org/apache/struts/resources/struts-config_1_4.dtd Sat Jul 21 20:33:53 2007
@@ -386,8 +386,8 @@
command The name of a commons-chain command which should be looked up
and executed as part of servicing this request.
- extends The path of the action mapping configuration that this
- will inherit configuration information from.
+ extends The path or actionId of the action mapping configuration
+ that this will inherit configuration information from.
forward Module-relative path of the servlet or other resource that
will process this request, instead of the Action class