You can leave current class-based container autodetection (with fix for Tomcat) and add override parameter read from ServletContext#getInitParameter() (set via context-param or container-specific mechanism like WEB-INF/jetty-web.xml for Jetty or META-INF/context.xml for Tomcat).
Than one can decide to allow only one container in web descriptor (with context-param set) or use set of specific webapp descriptors to deploy WAR to several container. In such case one can add META-INF/context.xml with
<?xml version="1.0" encoding="UTF-8"?>
<Context>
<Parameter name="...weld.container" value="tomcat" override="true"/>
</Context>
and WEB-INF/jetty-web.xml with
<?xml version="1.0"?>
<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "http://www.eclipse.org/jetty/configure.dtd">
<Configure id="webAppCtx" class="org.eclipse.jetty.webapp.WebAppContext">
<Call name="setInitParameter">
<Arg>...weld.container</Arg>
<Arg>jetty</Arg>
</Call>
</Configure>
to have container-agnostic deployment with overrides.
|