}
}
public void startServer() throws Exception
{
Server server = new Server();
Connector connector = new SelectChannelConnector();
connector.setPort(8080);
server.setConnectors(new Connector[]
{
connector
});
HandlerCollection handlers = new HandlerCollection();
ContextHandlerCollection contexts = new ContextHandlerCollection();
WebAppContext webAppContext1 = new WebAppContext("samples/actiontest/dist/actiontest", "/actiontest");
WebAppContext webAppContext2 = new WebAppContext("samples/holiday-booking/dist/holidaybooking",
"/holidaybooking");
contexts.addHandler(webAppContext1);
contexts.addHandler(webAppContext2);
/*
This code is required for hot deployment, although
it needs to point to a valid jetty.xml file to work
correctly (ie it won't currently work)
ContextDeployer contextDeployer = new ContextDeployer();
server.addLifeCycle(contextDeployer);
contextDeployer.setContexts(contexts);
contextDeployer.setScanInterval(10);
contexts.setServer(server);
*/
RequestLogHandler requestLogHandler = new RequestLogHandler();
handlers.setHandlers(new Handler[]
{
contexts, new DefaultHandler(), requestLogHandler
});
server.setHandler(handlers);
server.setStopAtShutdown(true);
server.setSendServerVersion(true);
server.start();
server.join();
}