(三)——Servlet
1 package my.tomcat2; 2 3 import java.net.Socket; 4 5 /** 6 * 用来封装 Request 和 Response,也就是客户端发来的请求和回应 7 */ 8 public abstract class Servlet { 9 10 protected void service(Request request, Response response){ 11 this.doGet(request, response); 12 this.doPost(request, response); 13 } 14 15 protected abstract void doGet(Request request, Response response); 16 protected abstract void doPost(Request request, Response response); 17 }