use of org.eclipse.jetty.server.bio.SocketConnector in project wicket-dashboard by decebals.
the class Start method main.
public static void main(String[] args) throws Exception {
Server server = new Server();
SocketConnector connector = new SocketConnector();
// Set some timeout options to make debugging easier.
connector.setMaxIdleTime(1000 * 60 * 60);
connector.setSoLingerTime(-1);
int port = Integer.parseInt(System.getProperty("jetty.port", "8081"));
connector.setPort(port);
server.addConnector(connector);
WebAppContext webAppContext = new WebAppContext();
webAppContext.setServer(server);
webAppContext.setContextPath("/");
webAppContext.setWar("src/main/webapp");
server.setHandler(webAppContext);
try {
System.out.println(">>> STARTING EMBEDDED JETTY SERVER (" + port + "), PRESS ANY KEY TO STOP");
server.start();
System.in.read();
System.out.println(">>> STOPPING EMBEDDED JETTY SERVER");
// while (System.in.available() == 0) {
// Thread.sleep(5000);
// }
server.stop();
server.join();
} catch (Exception e) {
e.printStackTrace();
System.exit(100);
}
}
use of org.eclipse.jetty.server.bio.SocketConnector in project BeyondUPnP by kevinshine.
the class AndroidJettyServletContainer method addConnector.
@Override
public synchronized int addConnector(String host, int port) throws IOException {
SocketConnector connector = new SocketConnector();
connector.setHost(host);
connector.setPort(port);
// Open immediately so we can get the assigned local port
connector.open();
// Only add if open() succeeded
server.addConnector(connector);
// stats the connector if the server is started (server starts all connectors when started)
if (server.isStarted()) {
try {
connector.start();
} catch (Exception ex) {
log.severe("Couldn't start connector: " + connector + " " + ex);
throw new RuntimeException(ex);
}
}
return connector.getLocalPort();
}
use of org.eclipse.jetty.server.bio.SocketConnector in project h2o-3 by h2oai.
the class JettyHTTPD method startHttp.
protected void startHttp() throws Exception {
_server = new Server();
// QueuedThreadPool p = new QueuedThreadPool();
// p.setName("jetty-h2o");
// p.setMinThreads(3);
// p.setMaxThreads(50);
// p.setMaxIdleTimeMs(3000);
// _server.setThreadPool(p);
Connector connector = new SocketConnector();
connector.setHost(_ip);
connector.setPort(_port);
createServer(connector);
}
use of org.eclipse.jetty.server.bio.SocketConnector in project head by mifos.
the class AbstractServerLauncher method createServer.
protected Server createServer() {
if (server != null) {
throw new IllegalStateException("HTTP Server already running, stop it first before starting it again");
}
server = new Server();
final SocketConnector connector = new SocketConnector();
connector.setPort(port);
connector.setMaxIdleTime(1000 * 60 * 60);
connector.setSoLingerTime(-1);
server.setConnectors(new Connector[] { connector });
return server;
}
Aggregations