rleland 2003/07/25 21:21:07
Modified: src/share/org/apache/struts/action ActionServlet.java
Log:
Add servlet parameter to set the Factory used to create
the ModuleConfig implementation
Revision Changes Path
1.163 +23 -7
jakarta-struts/src/share/org/apache/struts/action/ActionServlet.java
Index: ActionServlet.java
===================================================================
RCS file:
/home/cvs/jakarta-struts/src/share/org/apache/struts/action/ActionServlet.java,v
retrieving revision 1.162
retrieving revision 1.163
diff -u -r1.162 -r1.163
--- ActionServlet.java 16 Jul 2003 04:40:53 -0000 1.162
+++ ActionServlet.java 26 Jul 2003 04:21:06 -0000 1.163
@@ -188,6 +188,11 @@
* containing the configuration information for the module that
* will use the specified prefix (/${module}). This can be repeated as many
* times as required for multiple modules. (Since Struts 1.1)</li>
+ * <li><strong>configFactory</strong> - The Java class name of the
+ * <code>ModuleConfigFactory</code> used to create the implementation of the
+ * <code>ModuleConfig</code> interface.
+ * [org.apache.struts.config.impl.DefaultModuleConfigFactory]
+ * </li>
* <li><strong>convertNull</strong> - Force simulation of the Struts 1.0 behavior
* when populating forms. If set to true, the numeric Java wrapper class types
* (like <code>java.lang.Integer</code>) will default to null (rather than 0).
@@ -379,7 +384,7 @@
initServlet();
getServletContext().setAttribute(Globals.ACTION_SERVLET_KEY, this);
-
+ initModuleConfigFactory();
// Initialize modules as needed
ModuleConfig moduleConfig = initModuleConfig("", config);
initModuleMessageResources(moduleConfig);
@@ -649,8 +654,20 @@
return (RequestProcessor) getServletContext().getAttribute(key);
}
+
+ /**
+ * <p>Initialize the factory used to create the module configuration.</p>
+ * @since Struts 1.2
+ */
+ protected void initModuleConfigFactory(){
+ String configFactory = getServletConfig().getInitParameter("configFactory");
+ if (configFactory != null) {
+ ModuleConfigFactory.setFactoryClass(configFactory);
+ }
+ }
+
/**
- * <p>Initialize the application configuration information for the
+ * <p>Initialize the module configuration information for the
* specified module.</p>
*
* @param prefix Module prefix for this module
@@ -673,7 +690,6 @@
}
// Parse the configuration for this module
- // TODO Replace with a FactoryMethod
ModuleConfigFactory factoryObject = ModuleConfigFactory.createFactory();
ModuleConfig config = factoryObject.createModuleConfig(prefix);
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]