主要看这两个类
Bootstrap为启动类,ServletProcessor处理创建request和response
其中inputStream转换为SocketInputStream,
使用httpRequest(继承自httpServletRequest类)
还有parseRequest()和parseHeader()处理request和response的相关属性
给request和response处理完相关属性后,处理逻辑跟第二章是一样的
if (request.getRequestURI().startsWith("/servlet/")) {
ServletProcessor processor = new ServletProcessor();
processor.process(request, response);
} else {
StaticResourceProcessor processor = new StaticResourceProcessor();
processor.process(request, response);
}
网友评论