This is an automated email from the ASF dual-hosted git repository. markt pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/tomcat.git
commit a96fbeae96f3456a525b327dcfc006e3671dfc99 Author: Mark Thomas <ma...@apache.org> AuthorDate: Tue Apr 29 20:18:32 2025 +0100 Start to re-do the sequence diagrams for request processing NIOEndpoint to Processor --- webapps/docs/architecture/requestProcess.xml | 51 +++++++++-- .../architecture/requestProcess/1_nio.plantuml | 93 +++++++++++++++++++++ webapps/docs/architecture/requestProcess/1_nio.png | Bin 0 -> 105158 bytes 3 files changed, 136 insertions(+), 8 deletions(-) diff --git a/webapps/docs/architecture/requestProcess.xml b/webapps/docs/architecture/requestProcess.xml index 1d8adbceb3..97ec32d73f 100644 --- a/webapps/docs/architecture/requestProcess.xml +++ b/webapps/docs/architecture/requestProcess.xml @@ -29,21 +29,56 @@ <body> +<section name="Introduction"> +<p> +This page describes how requests flow through Tomcat during processing. Requests +start processing in an endpoint, then get passed to the protocol and then the +Coyote adapter which is the common entry point for all servlet request +processing. +</p> +</section> -<section name="Request Process Flow"> +<section name="Endpoint implementations"> +<p> +UML diagrams have been created for each Endpoint implementation to show how +requests flow from the endpoint to the protocol. +</p> +<p> +<a href="requestProcess/1_nio.png">Diagram 1</a> shows how requests received via +an NIO based endpoint are processed upto the point they reach the processor +instance. +</p> +<p> +NIO2 - TBD. +</p> +</section> +<section name="Protocols"> +<p> +UML diagrams have been created for each protocol to show how requests flow from +the processor instance to the CoyoteAdapter. +</p> +<p> +HTTP/1.1 TBD. +</p> <p> -This page describes the process used by Tomcat to handle -an incoming request. This process is largely defined by -the Servlet Specification, which outlines the order -of events that must take place. +HTTP/2 - TBD. </p> +<p> +AJP - TBD. +</p> +</section> -<subsection name="description"> +<section name="Servlet engine"> <p> -TODO +Synchronous - TBD </p> -</subsection> +<p> +Asynchronous - TBD. +</p> +</section> + +<section name="Legacy information"> <subsection name="diagrams"> <p> diff --git a/webapps/docs/architecture/requestProcess/1_nio.plantuml b/webapps/docs/architecture/requestProcess/1_nio.plantuml new file mode 100644 index 0000000000..03608a5737 --- /dev/null +++ b/webapps/docs/architecture/requestProcess/1_nio.plantuml @@ -0,0 +1,93 @@ +@startuml + +' Licensed to the Apache Software Foundation (ASF) under one or more +' contributor license agreements. See the NOTICE file distributed with +' this work for additional information regarding copyright ownership. +' The ASF licenses this file to You under the Apache License, Version 2.0 +' (the "License"); you may not use this file except in compliance with +' the License. You may obtain a copy of the License at +' +' http://www.apache.org/licenses/LICENSE-2.0 +' +' Unless required by applicable law or agreed to in writing, software +' distributed under the License is distributed on an "AS IS" BASIS, +' WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +' See the License for the specific language governing permissions and +' limitations under the License. + +hide footbox +skinparam style strictuml + +activate Acceptor +participant NioEndpoint +participant ServerSocket +participant SocketChannel +activate Poller +participant Selector +participant Executor +activate Worker + +group Acceptor Loop +Acceptor -> NioEndpoint ++: serverSocketAccept() +NioEndpoint -> ServerSocket ++: accept() +note right of ServerSocket + This is where Tomcat + waits for incoming + connections +end note +ServerSocket -->> SocketChannel **: +return +return + +Acceptor -> NioEndpoint ++: setSocketOptions() +NioEndpoint -> Poller ++: register() +return +return +end + +group Poller Loop (simplified) +Poller -> Poller ++: events() +Poller -> SocketChannel ++: register(OP_READ) +return +return + +Poller -> Selector ++: select() +return + +Poller -> Poller ++: processKey() +Poller -> NioEndpoint ++: processSocket() +NioEndpoint -> NioEndpoint ++: createSocketProcessor() +NioEndpoint -->> SocketProcessor **: +NioEndpoint -> Executor ++: execute() +Executor -> Worker ++: run() +return +return +return +return +return +end + +Worker -> SocketProcessor ++: run() +SocketProcessor -> SocketChannel ++: handshake() +note right of SocketChannel + TLS handshake +end note +return +SocketProcessor -> ConnectionHandler ++: process() +ConnectionHandler -> Protocol ++: createProcessor() +Protocol -->> Processor **: +return +ConnectionHandler -> Processor ++: process() +Processor -> Processor ++: service() +note right of Processor + More detail of this + processing in the + protocol specific + diagrams +end note +return +return +return +return + +@enduml \ No newline at end of file diff --git a/webapps/docs/architecture/requestProcess/1_nio.png b/webapps/docs/architecture/requestProcess/1_nio.png new file mode 100644 index 0000000000..32cf126b80 Binary files /dev/null and b/webapps/docs/architecture/requestProcess/1_nio.png differ --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org