forked from liangrui1988/java-admin
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSimpleMain.java
More file actions
30 lines (26 loc) · 900 Bytes
/
Copy pathSimpleMain.java
File metadata and controls
30 lines (26 loc) · 900 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
package com.huiwan.gdata;
import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.server.nio.SelectChannelConnector;
import org.eclipse.jetty.util.thread.ExecutorThreadPool;
import org.eclipse.jetty.server.Handler;
import org.eclipse.jetty.webapp.WebAppContext;
import org.eclipse.jetty.webapp.WebAppContext;
public class SimpleMain {
public static void main(String[] args) throws Exception {
Server server = new Server();
SelectChannelConnector connector = new SelectChannelConnector();
// 设置线程
server.setThreadPool(new ExecutorThreadPool());
// 端口
connector.setPort(9899);
// 设置handler
// 项目目录名/src/main/webapp
// lib/webapp
// demo
// Handler handler=new WebAppContext("src/main/webapp", "/");
server.setHandler(new WebAppContext("src/main/webapp", "/zdata"));
// 连接器
server.addConnector(connector);
server.start();
}
}