public ContainerMethodExecutor deploy(Context context, Archive<?> archive) throws DeploymentException
{
try
{
WebAppContext wctx = archive.as(ShrinkWrapWebAppContext.class);
// Jetty plus is required to support in-container invocation and enrichment
if (containerConfig.isJettyPlus())
{
wctx.setConfigurationClasses(JETTY_PLUS_CONFIGURATION_CLASSES);
}
// HACK this needs to be rethought, perhaps another auxiliary archive appender to guarantee uniqueness and a static check for run mode?
// if (archive.contains(ArchivePaths.create("/WEB-INF/lib/arquillian-protocol.jar")))
// {
// // wctx.setOverrideDescriptor("jar:file:" + wctx.getTempDirectory() + "/webapp/WEB-INF/lib/arquillian-protocol.jar!/META-INF/web-fragment.xml");
// // NOTE go on faith there is only one META-INF/web-fragment.xml
// wctx.setOverrideDescriptor("META-INF/web-fragment.xml");
// }
// possible configuration parameters
wctx.setExtractWAR(true);
wctx.setLogUrlOnStart(true);
/*
* ARQ-242 Without this set we result in failure on loading Configuration in container.
* ServiceLoader finds service file from AppClassLoader, tried to load JettyContainerConfiguration from AppClassLoader
* as a ContainerConfiguration from WebAppClassContext. ClassCastException.
*/
wctx.setParentLoaderPriority(true);
server.addHandler(wctx);
wctx.start();
context.add(WebAppContext.class, wctx);
}
catch (Exception e)
{
throw new DeploymentException("Could not deploy " + archive.getName(), e);