時(shí)間:2023-07-12 09:03:02 | 來源:網(wǎng)站運(yùn)營
時(shí)間:2023-07-12 09:03:02 來源:網(wǎng)站運(yùn)營
牛逼!硬核圖解 Tomcat 整體架構(gòu):// Calling the containerconnector.getService().getContainer().getPipeline().getFirst().invoke(request, response);
wrapper 容器的最后一個(gè) valve 創(chuàng)建一個(gè) filter 鏈,并調(diào)用 doFilter 方法,最終會調(diào)用到 servlet 的 service 方法。 final class StandardWrapperValve extends ValveBase { @Override public final void invoke(Request request, Response response) throws IOException, ServletException { // ... ApplicationFilterChain filterChain = ApplicationFilterFactory.createFilterChain(request, wrapper, servlet); // Call the filter chain for this request // NOTE: This also calls the servlet's service() method Container container = this.container; try { if ((servlet != null) && (filterChain != null)) { // Swallow output if needed if (context.getSwallowOutput()) { try { SystemLogHandler.startCapture(); if (request.isAsyncDispatching()) { request.getAsyncContextInternal().doInternalDispatch(); } else { // dofilter filterChain.doFilter(request.getRequest(), response.getResponse()); } } finally { String log = SystemLogHandler.stopCapture(); if (log != null && log.length() > 0) { context.getLogger().info(log); } } } else { if (request.isAsyncDispatching()) { request.getAsyncContextInternal().doInternalDispatch(); } else { // dofilter filterChain.doFilter (request.getRequest(), response.getResponse()); } } } } catch() { // ... } }}
ServletContext 是 tomcat 中的一個(gè)成員變量,spring 中的 ApplicationContext 是 servlet 規(guī)范中的 ServletContext 屬性。原作者:rhspher
原文鏈接:牛逼!硬核圖解 Tomcat 整體架構(gòu)
原出處:碼農(nóng)code之路
侵刪
關(guān)鍵詞:整體,圖解
客戶&案例
營銷資訊
關(guān)于我們
微信公眾號
版權(quán)所有? 億企邦 1997-2025 保留一切法律許可權(quán)利。