I'm using the following (based on this) to create an embedded Tomcat server:
File catalinaHome = new File(".");
File webAppDir = new File("web");
Embedded server = new Embedded();
server.setCatalinaHome(catalinaHome.getAbsolutePath());
Context rootContext = server.createContext("", webAppDir.getAbsolutePath());
rootContext.setParentClassLoader(Thread.currentThread().getContextClassLoader());
Host localHost = server.createHost("localhost", webAppDir.getAbsolutePath());
localHost.addChild(rootContext);
Engine engine = server.createEngine();
engine.setName("localEngine");
engine.addChild(localHost);
engine.setDefaultHost(localHost.getName());
server.addEngine(engine);
Connector http = server.createConnector((InetAddress) null, 8080, false);
server.addConnector(http);
server.setAwait(true);
server.start();
The web directory has static content (index.html, etc.) as well as a WEB-INF directory with servlet descriptors like web.xml. This is starting without exception and the servlets defined in web.xml work, but static content like index.html aren't working.
I'm confused: what am I missing to get the static content handled?