use of org.mortbay.jetty.handler.DefaultHandler in project maven-plugins by apache.
the class SiteRunMojo method execute.
/**
* @see org.apache.maven.plugin.AbstractMojo#execute()
*/
public void execute() throws MojoExecutionException, MojoFailureException {
checkInputEncoding();
Server server = new Server();
server.setStopAtShutdown(true);
Connector defaultConnector = getDefaultConnector();
server.setConnectors(new Connector[] { defaultConnector });
WebAppContext webapp = createWebApplication();
webapp.setServer(server);
DefaultHandler defaultHandler = new DefaultHandler();
defaultHandler.setServer(server);
Handler[] handlers = new Handler[2];
handlers[0] = webapp;
handlers[1] = defaultHandler;
server.setHandlers(handlers);
getLog().info("Starting Jetty on http://localhost:" + port + "/");
try {
server.start();
} catch (Exception e) {
throw new MojoExecutionException("Error executing Jetty: " + e.getMessage(), e);
}
// Watch it
try {
server.getThreadPool().join();
} catch (InterruptedException e) {
getLog().warn("Jetty was interrupted", e);
}
}
Aggregations