Work in progress on Features for QuickStart
This commit is contained in:
parent
c5f0c80cd2
commit
fd34007c3d
|
@ -19,12 +19,20 @@
|
|||
package org.eclipse.jetty.quickstart;
|
||||
|
||||
import java.io.FileOutputStream;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
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.Logger;
|
||||
import org.eclipse.jetty.util.resource.JarResource;
|
||||
import org.eclipse.jetty.util.resource.Resource;
|
||||
import org.eclipse.jetty.webapp.Configuration;
|
||||
import org.eclipse.jetty.webapp.WebAppContext;
|
||||
|
||||
/**
|
||||
|
@ -33,35 +41,26 @@ import org.eclipse.jetty.webapp.WebAppContext;
|
|||
public class QuickStartWebApp extends WebAppContext
|
||||
{
|
||||
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 _autoPreconfigure=false;
|
||||
private boolean _startWebapp=false;
|
||||
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.WebXmlConfiguration.class.getCanonicalName(),
|
||||
org.eclipse.jetty.webapp.MetaInfConfiguration.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(),
|
||||
};
|
||||
}));
|
||||
|
||||
public QuickStartWebApp()
|
||||
{
|
||||
super();
|
||||
setConfigurationClasses(__preconfigurationClasses);
|
||||
addConfiguration(new EnvConfiguration(),new PlusConfiguration(),new AnnotationConfiguration());
|
||||
setAttribute("org.eclipse.jetty.server.webapp.ContainerIncludeJarPattern",".*\\.jar");
|
||||
}
|
||||
|
||||
|
@ -152,7 +151,10 @@ public class QuickStartWebApp extends WebAppContext
|
|||
}
|
||||
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;
|
||||
}
|
||||
else if (_autoPreconfigure)
|
||||
|
|
|
@ -48,7 +48,12 @@ public class Configurations extends AbstractList<Configuration>
|
|||
ServiceLoader<Configuration> configs = ServiceLoader.load(Configuration.class);
|
||||
for (Configuration configuration : configs)
|
||||
__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());
|
||||
}
|
||||
|
||||
|
@ -251,7 +256,10 @@ public class Configurations extends AbstractList<Configuration>
|
|||
|
||||
sort.sort(_configurations);
|
||||
if (LOG.isDebugEnabled())
|
||||
LOG.debug("sorted {}",_configurations);
|
||||
{
|
||||
for (Configuration c: _configurations)
|
||||
LOG.debug("sorted {}",c);
|
||||
}
|
||||
}
|
||||
|
||||
public List<Configuration> getConfigurations()
|
||||
|
|
|
@ -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
|
Loading…
Reference in New Issue