use of org.mortbay.jetty.Server 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);
}
}
use of org.mortbay.jetty.Server in project maven-archetype by apache.
the class ArchetyperRoundtripIT method setUp.
public void setUp() throws Exception {
super.setUp();
// Start Jetty
System.setProperty("org.apache.maven.archetype.repository.directory", getTestPath("target/test-classes/repositories/central"));
server = new Server(0);
WebAppContext webapp = new WebAppContext();
webapp.setContextPath("/repo");
webapp.setWar("target/wars/archetype-repository.war");
server.setHandler(webapp);
server.start();
port = server.getConnectors()[0].getLocalPort();
}
use of org.mortbay.jetty.Server in project maven-archetype by apache.
the class ArchetyperRoundtripWithProxyIT method setUp.
public void setUp() throws Exception {
super.setUp();
// Start Proxy Jetty
System.setProperty("org.apache.maven.archetype.repository.directory", getTestPath("target/test-classes/repositories/central"));
proxyServer = new Server(0);
WebAppContext webappProxy = new WebAppContext();
webappProxy.setContextPath("/");
webappProxy.setWar("target/wars/archetype-proxy.war");
proxyServer.setHandler(webappProxy);
proxyServer.start();
proxyPort = proxyServer.getConnectors()[0].getLocalPort();
server = new Server(0);
WebAppContext webapp = new WebAppContext();
webapp.setContextPath("/repo");
webapp.setWar("target/wars/archetype-repository.war");
server.setHandler(webapp);
server.start();
port = server.getConnectors()[0].getLocalPort();
}
use of org.mortbay.jetty.Server in project eureka by Netflix.
the class MockRemoteEurekaServer method start.
public void start() throws Exception {
server = new Server(port);
server.setHandler(new AppsResourceHandler());
server.start();
port = server.getConnectors()[0].getLocalPort();
}
Aggregations