jetty 代码启动

jetty代码启动

jetty 版本为:jetty-distribution-8.1.16.v20140903

  1. public class ServerStart extends Server {
  2. @Test
  3. public void serverStrart() throws Exception {
  4. long begin = System.currentTimeMillis();
  5. Connector connector = new SelectChannelConnector();
  6. connector.setPort(Integer.getInteger("jetty.port", 8888).intValue());
  7. WebAppContext webapp = new WebAppContext("F:/EDev/OA/Code/webapps/OA", "/");
  8. Server server = new Server();
  9. server.setConnectors(new Connector[] { connector });
  10. server.setHandler(webapp);
  11. server.start();
  12. server.join();
  13. System.out.println("Jetty Server started, use " + (System.currentTimeMillis() - begin) + " ms");
  14. }

posted on 2017-03-24 08:51  signheart  阅读(974)  评论(0编辑  收藏  举报

导航