这个适配器类只讲2个方法,构造方法中我们看到一个适配器对象有自己关联的连接器类。

其中Service的重要任务就是讲客户端端请求交给容器。

public void service(org.apache.coyote.Request req,
org.apache.coyote.Response res)
throws Exception { Request request = (Request) req.getNote(ADAPTER_NOTES);
Response response = (Response) res.getNote(ADAPTER_NOTES); if (request == null) { // Create objects
request = connector.createRequest();
request.setCoyoteRequest(req);
response = connector.createResponse();
response.setCoyoteResponse(res); // Link objects
request.setResponse(response);
response.setRequest(request); // Set as notes
req.setNote(ADAPTER_NOTES, request);
res.setNote(ADAPTER_NOTES, response); // Set query string encoding
req.getParameters().setQueryStringEncoding
(connector.getURIEncoding()); } connector.getService().getContainer().getPipeline().getFirst().invoke(request, response);
//最终的方法,获得连接器-->服务--》容器-》管道---》第一个value

} }
AsyncContextImpl asyncConImpl = (AsyncContextImpl)request.getAsyncContext();
if (asyncConImpl != null) {
async = true;
ReadListener readListener = req.getReadListener();
if (readListener != null && request.isFinished()) {
// Possible the all data may have been read during service()
// method so this needs to be checked here
ClassLoader oldCL =
Thread.currentThread().getContextClassLoader();
ClassLoader newCL =
request.getContext().getLoader().getClassLoader();
try {
Thread.currentThread().setContextClassLoader(newCL);
if (req.sendAllDataReadEvent()) {
req.getReadListener().onAllDataRead();
}
} finally {
Thread.currentThread().setContextClassLoader(oldCL);
}
}
} else if (!comet) {
request.finishRequest();
response.finishResponse();
if (postParseSuccess &&
request.getMappingData().context != null) {
// Log only if processing was invoked.
// If postParseRequest() failed, it has already logged it.
// If context is null this was the start of a comet request
// that failed and has already been logged.
request.getMappingData().context.logAccess(
request, response,
System.currentTimeMillis() - req.getStartTime(),
false);
}
} } catch (IOException e) {
// Ignore
} finally {
req.getRequestProcessor().setWorkerThreadName(null);
AtomicBoolean error = new AtomicBoolean(false);
res.action(ActionCode.IS_ERROR, error);
// Recycle the wrapper request and response
if (!comet && !async || error.get()) {
request.recycle();
response.recycle();
} else {
// Clear converters so that the minimum amount of memory
// is used by this processor
request.clearEncoders();
response.clearEncoders();
}
} }

最新文章

  1. Struts2 框架的快速搭建
  2. requestDisallowInterceptTouchEvent
  3. [shell基础]——read命令
  4. iOS定位 - 普通定位(没有地图) - 反地理编码(得到具体位置)
  5. Win7,8的上帝模式文件夹 GodMode.{ED7BA470-8E54-465E-825C-99712043E01C}
  6. OSChina 其中很重要的一类——RequestContext
  7. WCF消息
  8. Sharepoint 2013 --系统安装配置
  9. IOS开发-UI学习-UITextField的具体属性及用法
  10. Ehcache 的简单实用 及配置
  11. Gradle 1.12用户指南翻译——第四十二章. Announce插件
  12. Google Translation Via Python
  13. Hadoop基础-Hadoop的集群管理之服役和退役
  14. 安装SQl Server 报错 "需要 Microsoft.NET Framework 3.5 ServicePack 1" 解决方法
  15. Struts框架(6)---action接收请求参数
  16. Python---http协议.md
  17. python __init__.py 的作用
  18. vue-cli生成的项目配置开发和生产环境不同的接口
  19. mfc 类的友元函数
  20. Python学习 :常用模块(三)----- 日志记录

热门文章

  1. 1048: [HAOI2007]分割矩阵 - BZOJ
  2. Python/Ruby/Go/Node 之四国大战
  3. strip_tags() 函数剥去 HTML、XML 以及 PHP 的标签
  4. linux和window下mkdir函数
  5. js 实现list类
  6. cctype头文件(字符处理库)的使用
  7. 【今日推荐】10大流行的 Metro UI 风格的 Bootstrap 主题和模板
  8. FTPClient 工具类
  9. WinAPI—— CallNextHookEx调用下一个钩子
  10. Java面试题-多线程