jetty 代码启动
jetty代码启动
jetty 版本为:jetty-distribution-8.1.16.v20140903
public class ServerStart extends Server {
@Test
public void serverStrart() throws Exception {
long begin = System.currentTimeMillis();
Connector connector = new SelectChannelConnector();
connector.setPort(Integer.getInteger("jetty.port", 8888).intValue());
WebAppContext webapp = new WebAppContext("F:/EDev/OA/Code/webapps/OA", "/");
Server server = new Server();
server.setConnectors(new Connector[] { connector });
server.setHandler(webapp);
server.start();
server.join();
System.out.println("Jetty Server started, use " + (System.currentTimeMillis() - begin) + " ms");
}