Author: mrdon
Date: Tue Sep 26 20:19:54 2006
New Revision: 450297

URL: http://svn.apache.org/viewvc?view=rev&rev=450297
Log:
Making the list of struts config files configurable
WW-1456

Modified:
    
struts/struts2/trunk/core/src/main/java/org/apache/struts2/StrutsConstants.java
    
struts/struts2/trunk/core/src/main/java/org/apache/struts2/dispatcher/Dispatcher.java

Modified: 
struts/struts2/trunk/core/src/main/java/org/apache/struts2/StrutsConstants.java
URL: 
http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/java/org/apache/struts2/StrutsConstants.java?view=diff&rev=450297&r1=450296&r2=450297
==============================================================================
--- 
struts/struts2/trunk/core/src/main/java/org/apache/struts2/StrutsConstants.java 
(original)
+++ 
struts/struts2/trunk/core/src/main/java/org/apache/struts2/StrutsConstants.java 
Tue Sep 26 20:19:54 2006
@@ -127,4 +127,7 @@
 
     /** Allows one to disable dynamic method invocation from the URL */
     public static final String STRUTS_ENABLE_DYNAMIC_METHOD_INVOCATION = 
"struts.enable.DynamicMethodInvocation";
+
+    /** A list of configuration files automatically loaded by Struts */
+    public static final String STRUTS_CONFIGURATION_FILES = 
"struts.configuration.files";
 }

Modified: 
struts/struts2/trunk/core/src/main/java/org/apache/struts2/dispatcher/Dispatcher.java
URL: 
http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/java/org/apache/struts2/dispatcher/Dispatcher.java?view=diff&rev=450297&r1=450296&r2=450297
==============================================================================
--- 
struts/struts2/trunk/core/src/main/java/org/apache/struts2/dispatcher/Dispatcher.java
 (original)
+++ 
struts/struts2/trunk/core/src/main/java/org/apache/struts2/dispatcher/Dispatcher.java
 Tue Sep 26 20:19:54 2006
@@ -251,12 +251,18 @@
         }
 
         configurationManager = new ConfigurationManager();
-        
-        // Load old xwork files
-        configurationManager.addConfigurationProvider(new 
XmlConfigurationProvider("xwork.xml", false));
-        
-        // Load Struts config files
-        configurationManager.addConfigurationProvider(new 
StrutsXmlConfigurationProvider(false));
+        String configFiles = 
Settings.get(StrutsConstants.STRUTS_CONFIGURATION_FILES);
+        if (configFiles == null) {
+            configFiles = "struts-default.xml,struts-plugins.xml,struts.xml";
+        }
+        String[] files = configFiles.split("\\s*[,]\\s*");
+        for (String file : files) {
+            if ("xwork.xml".equals(file)) {
+                configurationManager.addConfigurationProvider(new 
XmlConfigurationProvider(file, false));
+            } else {
+                configurationManager.addConfigurationProvider(new 
StrutsXmlConfigurationProvider(file, false));
+            }
+        }
         
         synchronized(Dispatcher.class) {
             if (dispatcherListeners.size() > 0) {


Reply via email to