高级java实验指导书(1)

public class Response { private OutputStream out; private Request request; public Response(Request request, OutputStream out){ this.request = request; this.out = out; } /** * 响应请求时执行的方法。该方法以请求的URI指定的文件内容作为响应 * @throws Exception */ public void invoke() throws Exception { String path = request.getUri(); if(path != null && path.length() > 0){ String url = Server.WEBROOT + path; System.out.println(url); File file = new File(url); if(!file.exists()){ file = new File(Server.WEBROOT + \33 } this.report(file); } }

public class BootStrap { public static void main(String[] args) throws Exception{ Server server = new Server(); server.start(); } }

(2)仔细阅读老师给的简化版Tomcat,画出其项目构架图。

四、实验结果

写实验报告。内容包括:

1、习题的运行结果,源程序。 2、程序调试中出现的错误提示。(英文、中文对照) 3、若有没通过的程序,分析原因。

34

五、选做题目

(1)编写运行一个简化的Tomcat服务器。

35

联系客服:779662525#qq.com(#替换为@)