use of org.mortbay.jetty.Connector in project roboguice by roboguice.
the class Main method main.
public static void main(String[] args) throws Exception {
Server server = new Server();
Connector connector = new SelectChannelConnector();
connector.setPort(8080);
server.setConnectors(new Connector[] { connector });
WebAppContext webapp = new WebAppContext("./root", "/example");
server.addHandler(webapp);
server.start();
server.join();
}
use of org.mortbay.jetty.Connector in project maven-plugins by apache.
the class SiteRunMojo method getDefaultConnector.
private Connector getDefaultConnector() {
Connector connector = new SelectChannelConnector();
connector.setPort(port);
connector.setMaxIdleTime(MAX_IDLE_TIME);
return connector;
}
use of org.mortbay.jetty.Connector 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.Connector in project maven-plugins by apache.
the class ProjectInfoReportUtilsTest method getDefaultConnector.
private Connector getDefaultConnector() {
Connector connector = new SelectChannelConnector();
connector.setMaxIdleTime(MAX_IDLE_TIME);
return connector;
}
Aggregations