/** 启动Jetty服务器, 仅启动一次. */
 protected static void startJetty() throws Exception {
   if (jettyServer == null) {
     jettyServer = JettyFactory.buildTestServer(Start.TEST_PORT, Start.CONTEXT);
     jettyServer.start();
     dataSource = SpringContextHolder.getBean("dataSource");
   }
 }
Example #2
0
  public static void main(String[] args) throws Exception {
    Server server = JettyFactory.buildNormalServer(PORT, CONTEXT);
    server.start();

    System.out.println("Server running at " + BASE_URL);
    System.out.println("Hit Enter in console to stop server");

    // wait for close
    System.in.read();
    server.stop();
    server.join();
    System.out.println("Server stopped");
  }