
-
Servelt容器例如Tomcat、Jetty等
-
Tomcat容器模型
分为4个等级,一个Context对应一个Web,Context配置举例:
<Context path="/simple01" docBase="/data/www/simple01"
reloadable="true" />

- 启动过程
Tomcat tomcat = getTomcatInstance();
File appDir = new File(getBuildDirectory(), "webapps/examples");
tomcat.addWebapp(null, "/examples", appDir.getAbsolutePath());
tomcat.start();
ByteChunk res = getUrl("http://localhost:" + getPort() +
"/examples/servlets/servlet/HelloWorldExample");
assertTrue(res.toString().indexOf("<h1>Hello World!</h1>") > 0);
- Servlet结构




近期评论