Skip to content

Instantly share code, notes, and snippets.

@jerboaa
Created July 13, 2016 14:04
Show Gist options
  • Save jerboaa/3756460ed338754ce5349b6591b0737c to your computer and use it in GitHub Desktop.
Save jerboaa/3756460ed338754ce5349b6591b0737c to your computer and use it in GitHub Desktop.
diff --git a/jetty-webapp/src/main/java/org/eclipse/jetty/webapp/Configuration.java b/jetty-webapp/src/main/java/org/eclipse/jetty/webapp/Configuration.java
index 005e90b..c2c9651 100644
--- a/jetty-webapp/src/main/java/org/eclipse/jetty/webapp/Configuration.java
+++ b/jetty-webapp/src/main/java/org/eclipse/jetty/webapp/Configuration.java
@@ -96,7 +96,7 @@ public interface Configuration
public class ClassList extends ArrayList<String>
- {
+ {
/* ------------------------------------------------------------ */
/** Get/Set/Create the server default Configuration ClassList.
* <p>Get the class list from: a Server bean; or the attribute (which can
@@ -140,12 +140,7 @@ public interface Configuration
if (attr instanceof String[])
return new ClassList((String[])attr);
}
- return new ClassList();
- }
-
- public ClassList()
- {
- this(WebAppContext.DEFAULT_CONFIGURATION_CLASSES);
+ return new DefaultClassList();
}
public ClassList(String[] classes)
@@ -198,4 +193,11 @@ public interface Configuration
}
}
+
+ class DefaultClassList extends ClassList {
+
+ private DefaultClassList() {
+ super(WebAppContext.DEFAULT_CONFIGURATION_CLASSES);
+ }
+ }
}
diff --git a/jetty-webapp/src/main/java/org/eclipse/jetty/webapp/WebAppContext.java b/jetty-webapp/src/main/java/org/eclipse/jetty/webapp/WebAppContext.java
index 924b223..a8a1d8e 100644
--- a/jetty-webapp/src/main/java/org/eclipse/jetty/webapp/WebAppContext.java
+++ b/jetty-webapp/src/main/java/org/eclipse/jetty/webapp/WebAppContext.java
@@ -71,6 +71,8 @@ import org.eclipse.jetty.util.log.Log;
import org.eclipse.jetty.util.log.Logger;
import org.eclipse.jetty.util.resource.Resource;
import org.eclipse.jetty.util.resource.ResourceCollection;
+import org.eclipse.jetty.webapp.Configuration.ClassList;
+import org.eclipse.jetty.webapp.Configuration.DefaultClassList;
/**
* Web Application Context Handler.
@@ -100,11 +102,20 @@ public class WebAppContext extends ServletContextHandler implements WebAppClassL
public static final String[] DEFAULT_CONFIGURATION_CLASSES =
{
- "org.eclipse.jetty.webapp.WebInfConfiguration",
- "org.eclipse.jetty.webapp.WebXmlConfiguration",
- "org.eclipse.jetty.webapp.MetaInfConfiguration",
- "org.eclipse.jetty.webapp.FragmentConfiguration",
- "org.eclipse.jetty.webapp.JettyWebXmlConfiguration"
+ "org.eclipse.jetty.webapp.WebInfConfiguration",
+ "org.eclipse.jetty.webapp.WebXmlConfiguration",
+ "org.eclipse.jetty.webapp.MetaInfConfiguration",
+ "org.eclipse.jetty.webapp.FragmentConfiguration",
+ "org.eclipse.jetty.webapp.JettyWebXmlConfiguration"
+ } ;
+
+ public static final Configuration[] DEFAULT_CONFIGURATIONS =
+ {
+ new WebInfConfiguration(),
+ new WebXmlConfiguration(),
+ new MetaInfConfiguration(),
+ new FragmentConfiguration(),
+ new JettyWebXmlConfiguration()
} ;
// System classes are classes that cannot be replaced by
@@ -925,8 +936,16 @@ public class WebAppContext extends ServletContextHandler implements WebAppClassL
if (_configurations.size()>0)
return;
- if (_configurationClasses.size()==0)
- _configurationClasses.addAll(Configuration.ClassList.serverDefault(getServer()));
+ if (_configurationClasses.size()==0) {
+ ClassList serverDefault = Configuration.ClassList.serverDefault(getServer());
+ if (serverDefault instanceof DefaultClassList) {
+ _configurationClasses.addAll(serverDefault);
+ _configurations.addAll(Arrays.asList(DEFAULT_CONFIGURATIONS));
+ return;
+ } else {
+ _configurationClasses.addAll(serverDefault);
+ }
+ }
for (String configClass : _configurationClasses)
_configurations.add((Configuration)Loader.loadClass(configClass).newInstance());
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment