|
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
|
//代码:以嵌入模式启动Jettyimport org.mortbay.http.HttpContext;import org.mortbay.http.HttpServer;import org.mortbay.http.SocketListener;import org.mortbay.http.handler.ResourceHandler;public class JettySample{public static void main(String[]args)throws Exception{//创建JettyHttpServer对象 HttpServer server=new HttpServer();//在端口8080上给HttpServer对象绑上一个listener,使之能够接收HTTP请求SocketListener listener=new SocketListener();listener.setPort(8080);server.addListener(listener);//创建一个HttpContext,处理HTTP请求。HttpContext context=new HttpContext();//用setContextPath把Context映射到(/web)URL上。context.setContextPath("/web");//setResourceBase方法设置文档目录以提供资源context.setResourceBase("C:\\j2sdk1.4.1_05");//添加资源处理器到HttpContext,使之能够提供文件系统中的文件context.addHandler(new ResourceHandler());server.addContext(context);//启动服务器server.start();}} |
|
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
|
<?xmlversion="1.0"encoding="utf-8"?><plugin><groupId>org.mortbay.jetty</groupId><artifactId>maven-jetty-plugin</artifactId><version>6.1.10</version><configuration><scanIntervalSeconds>10</scanIntervalSeconds><stopKey>foo</stopKey><stopPort>9999</stopPort></configuration><executions><execution><id>start-jetty</id><phase>pre-integration-test</phase><goals><goal>run</goal></goals><configuration><scanIntervalSeconds>0</scanIntervalSeconds><daemon>true</daemon></configuration></execution><execution><id>stop-jetty</id><phase>post-integration-test</phase><goals><goal>stop</goal></goals></execution></executions></plugin> |
|
1
|
<pluginGroup>org.mortbay.jetty</pluginGroup> |
|
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
|
//代码:以嵌入模式启动Jettyimport org.mortbay.http.HttpContext;import org.mortbay.http.HttpServer;import org.mortbay.http.SocketListener;import org.mortbay.http.handler.ResourceHandler;public class JettySample{public static void main(String[]args)throws Exception{//创建JettyHttpServer对象 HttpServer server=new HttpServer();//在端口8080上给HttpServer对象绑上一个listener,使之能够接收HTTP请求SocketListener listener=new SocketListener();listener.setPort(8080);server.addListener(listener);//创建一个HttpContext,处理HTTP请求。HttpContext context=new HttpContext();//用setContextPath把Context映射到(/web)URL上。context.setContextPath("/web");//setResourceBase方法设置文档目录以提供资源context.setResourceBase("C:\\j2sdk1.4.1_05");//添加资源处理器到HttpContext,使之能够提供文件系统中的文件context.addHandler(new ResourceHandler());server.addContext(context);//启动服务器server.start();}} |
|
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
|
<?xmlversion="1.0"encoding="utf-8"?><plugin><groupId>org.mortbay.jetty</groupId><artifactId>maven-jetty-plugin</artifactId><version>6.1.10</version><configuration><scanIntervalSeconds>10</scanIntervalSeconds><stopKey>foo</stopKey><stopPort>9999</stopPort></configuration><executions><execution><id>start-jetty</id><phase>pre-integration-test</phase><goals><goal>run</goal></goals><configuration><scanIntervalSeconds>0</scanIntervalSeconds><daemon>true</daemon></configuration></execution><execution><id>stop-jetty</id><phase>post-integration-test</phase><goals><goal>stop</goal></goals></execution></executions></plugin> |
|
1
|
<pluginGroup>org.mortbay.jetty</pluginGroup> |
【转】收集 jetty、tomcat、jboss、weblogic 的比较
原文:https://www.cnblogs.com/UUUz/p/9683075.html