Work in progress on Features for QuickStart

This commit is contained in:
Greg Wilkins 2016-03-05 11:04:35 +01:00
parent c5f0c80cd2
commit fd34007c3d
3 changed files with 34 additions and 17 deletions

View File

@ -19,12 +19,20 @@
package org.eclipse.jetty.quickstart; package org.eclipse.jetty.quickstart;
import java.io.FileOutputStream; import java.io.FileOutputStream;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Locale; import java.util.Locale;
import java.util.Set;
import java.util.stream.Collectors;
import org.eclipse.jetty.annotations.AnnotationConfiguration;
import org.eclipse.jetty.plus.webapp.EnvConfiguration;
import org.eclipse.jetty.plus.webapp.PlusConfiguration;
import org.eclipse.jetty.util.log.Log; import org.eclipse.jetty.util.log.Log;
import org.eclipse.jetty.util.log.Logger; import org.eclipse.jetty.util.log.Logger;
import org.eclipse.jetty.util.resource.JarResource; import org.eclipse.jetty.util.resource.JarResource;
import org.eclipse.jetty.util.resource.Resource; import org.eclipse.jetty.util.resource.Resource;
import org.eclipse.jetty.webapp.Configuration;
import org.eclipse.jetty.webapp.WebAppContext; import org.eclipse.jetty.webapp.WebAppContext;
/** /**
@ -34,34 +42,25 @@ public class QuickStartWebApp extends WebAppContext
{ {
private static final Logger LOG = Log.getLogger(QuickStartWebApp.class); private static final Logger LOG = Log.getLogger(QuickStartWebApp.class);
public static final String[] __configurationClasses = new String[]
{
org.eclipse.jetty.quickstart.QuickStartConfiguration.class.getCanonicalName(),
org.eclipse.jetty.plus.webapp.EnvConfiguration.class.getCanonicalName(),
org.eclipse.jetty.plus.webapp.PlusConfiguration.class.getCanonicalName(),
org.eclipse.jetty.webapp.JettyWebXmlConfiguration.class.getCanonicalName()
};
private boolean _preconfigure=false; private boolean _preconfigure=false;
private boolean _autoPreconfigure=false; private boolean _autoPreconfigure=false;
private boolean _startWebapp=false; private boolean _startWebapp=false;
private PreconfigureDescriptorProcessor _preconfigProcessor; private PreconfigureDescriptorProcessor _preconfigProcessor;
public static final String[] __preconfigurationClasses = new String[] public static final Set<String> __replaceconfigurationClasses = new HashSet<>(
Arrays.asList(new String[]
{ {
org.eclipse.jetty.webapp.WebInfConfiguration.class.getCanonicalName(), org.eclipse.jetty.webapp.WebInfConfiguration.class.getCanonicalName(),
org.eclipse.jetty.webapp.WebXmlConfiguration.class.getCanonicalName(), org.eclipse.jetty.webapp.WebXmlConfiguration.class.getCanonicalName(),
org.eclipse.jetty.webapp.MetaInfConfiguration.class.getCanonicalName(), org.eclipse.jetty.webapp.MetaInfConfiguration.class.getCanonicalName(),
org.eclipse.jetty.webapp.FragmentConfiguration.class.getCanonicalName(), org.eclipse.jetty.webapp.FragmentConfiguration.class.getCanonicalName(),
org.eclipse.jetty.plus.webapp.EnvConfiguration.class.getCanonicalName(),
org.eclipse.jetty.plus.webapp.PlusConfiguration.class.getCanonicalName(),
org.eclipse.jetty.annotations.AnnotationConfiguration.class.getCanonicalName(), org.eclipse.jetty.annotations.AnnotationConfiguration.class.getCanonicalName(),
}; }));
public QuickStartWebApp() public QuickStartWebApp()
{ {
super(); super();
setConfigurationClasses(__preconfigurationClasses); addConfiguration(new EnvConfiguration(),new PlusConfiguration(),new AnnotationConfiguration());
setAttribute("org.eclipse.jetty.server.webapp.ContainerIncludeJarPattern",".*\\.jar"); setAttribute("org.eclipse.jetty.server.webapp.ContainerIncludeJarPattern",".*\\.jar");
} }
@ -152,7 +151,10 @@ public class QuickStartWebApp extends WebAppContext
} }
else if (qswebxml.exists()) else if (qswebxml.exists())
{ {
setConfigurationClasses(__configurationClasses); setConfigurations(Arrays.stream(getConfigurations())
.filter(c->!__replaceconfigurationClasses.contains(c.getName()))
.collect(Collectors.toList()).toArray(new Configuration[]{}));
addConfiguration(new QuickStartConfiguration());
_startWebapp=true; _startWebapp=true;
} }
else if (_autoPreconfigure) else if (_autoPreconfigure)

View File

@ -49,6 +49,11 @@ public class Configurations extends AbstractList<Configuration>
for (Configuration configuration : configs) for (Configuration configuration : configs)
__known.put(configuration.getName(),configuration); __known.put(configuration.getName(),configuration);
if (LOG.isDebugEnabled())
{
for (Map.Entry<String, Configuration> e: __known.entrySet())
LOG.debug("known {}",e);
}
LOG.debug("Known Configurations {}",__known.keySet()); LOG.debug("Known Configurations {}",__known.keySet());
} }
@ -251,7 +256,10 @@ public class Configurations extends AbstractList<Configuration>
sort.sort(_configurations); sort.sort(_configurations);
if (LOG.isDebugEnabled()) if (LOG.isDebugEnabled())
LOG.debug("sorted {}",_configurations); {
for (Configuration c: _configurations)
LOG.debug("sorted {}",c);
}
} }
public List<Configuration> getConfigurations() public List<Configuration> getConfigurations()

View File

@ -0,0 +1,7 @@
# Setup default logging implementation for during testing
org.eclipse.jetty.util.log.class=org.eclipse.jetty.util.log.StdErrLog
org.eclipse.jetty.LEVEL=INFO
org.eclipse.jetty.webapp.LEVEL=DEBUG
org.eclipse.jetty.quickstart.LEVEL=DEBUG
# org.eclipse.jetty.util.LEVEL=DEBUG
# org.eclipse.jetty.util.PathWatcher.Noisy.LEVEL=OFF