mirror of
https://github.com/apache/struts.git
synced 2026-08-06 23:27:07 +00:00
Making the list of struts config files configurable
WW-1456 git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@450297 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
@@ -127,4 +127,7 @@ public final class StrutsConstants {
|
||||
|
||||
/** 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";
|
||||
}
|
||||
|
||||
@@ -251,12 +251,18 @@ public class Dispatcher {
|
||||
}
|
||||
|
||||
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) {
|
||||
|
||||
Reference in New Issue
Block a user