Allow Configuration array to be set on Server instance and then applied to all webapps.

git-svn-id: svn+ssh://dev.eclipse.org/svnroot/rt/org.eclipse.jetty/jetty/trunk@1425 7e9141cc-0065-0410-87d8-b60c137991c4
This commit is contained in:
Jan Bartel 2010-03-30 18:14:54 +00:00
parent 681c29bcdb
commit a1742aa8a6
2 changed files with 10 additions and 21 deletions

View File

@ -8,6 +8,7 @@ jetty-7.0.2.SNAPSHOT
+ 306782 httpbis interpretation of 100 continues. Body never skipped
+ Take excess logging statements out of startup
+ Ensure webapps with no WEB-INF don't scan WEB-INF/lib
+ Allow Configuration array to be set on Server instance for all web apps
jetty-7.0.2.RC0
+ JSON parses NaN as null

View File

@ -74,7 +74,7 @@ public class WebAppContext extends ServletContextHandler
"org.eclipse.jetty.webapp.JettyWebXmlConfiguration",
"org.eclipse.jetty.webapp.TagLibConfiguration"
} ;
private String[] _configurationClasses=__dftConfigurationClasses;
private String[] _configurationClasses=null;
private Configuration[] _configurations;
private String _defaultsDescriptor=WEB_DEFAULTS_XML;
private String _descriptor=null;
@ -650,32 +650,20 @@ public class WebAppContext extends ServletContextHandler
{
if (_configurations!=null)
return;
if (_configurationClasses==null)
_configurationClasses=__dftConfigurationClasses;
int configsLen = _configurationClasses.length;
@SuppressWarnings("unchecked")
List<Configuration> serverConfigs = (List<Configuration>)getServer().getAttribute(SERVER_CONFIG);
//look for a Server attribute with the list of names of Configuration classes
//to apply to every web app. If not present, use our defaults.
String[] serverConfigs = (String[])getServer().getAttribute(SERVER_CONFIG);
if (serverConfigs != null)
{
configsLen += serverConfigs.size();
}
_configurations = new Configuration[configsLen];
_configurationClasses = serverConfigs;
if (_configurationClasses == null)
_configurationClasses=__dftConfigurationClasses;
_configurations = new Configuration[_configurationClasses.length];
for (int i = 0; i < _configurationClasses.length; i++)
{
_configurations[i]=(Configuration)Loader.loadClass(this.getClass(), _configurationClasses[i]).newInstance();
}
if (serverConfigs != null)
{
int offset = _configurationClasses.length;
for (int i = 0, n = serverConfigs.size(); i < n; i++)
{
_configurations[i + offset] = serverConfigs.get(i);
}
}
}
/* ------------------------------------------------------------ */