forked from dunwu/java-tutorial
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathQuickStartServer.java
More file actions
35 lines (28 loc) · 824 Bytes
/
Copy pathQuickStartServer.java
File metadata and controls
35 lines (28 loc) · 824 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
package io.github.dunwu.javaee.server;
import org.eclipse.jetty.server.Server;
/**
* 快速启动 jetty 服务器,方便测试
*
* @author <a href="mailto:forbreak@163.com">Zhang Peng</a>
*/
public class QuickStartServer {
// private static int STARTUP_TYPE = JettyFactory.IDE_ECLIPSE;
private static int STARTUP_TYPE = JettyFactory.IDE_INTELLIJ;
public static void main(String[] args) throws Exception {
Server server = JettyFactory.initServer();
JettyFactory.initWebAppContext(server, STARTUP_TYPE);
try {
JettyFactory.startServer(server);
// 等待用户输入回车重载应用
while (true) {
char c = (char) System.in.read();
if (c == '\n') {
JettyFactory.reloadWebAppContext(server);
}
}
} catch (Exception e) {
e.printStackTrace();
System.exit(-1);
}
}
}