#connector
Posts
-
Digging into Tomcat's Source 2: The Big Picture — Server, Service, Connector and the Four Containers
A map for anyone opening the Tomcat source for the first time. We look at which class each server.xml element (Server, Service, Connector, Engine, Host) turns into, how the four containers Engine, Host, Context and Wrapper are linked as parents and children, why the connector (Coyote) and the servlet container (Catalina) are kept apart and joined by a single Adapter, and where Jasper, EL, JULI and Naming live — all checked against the real source and examples I actually ran.
-
Digging into Tomcat's Source 5: The Connector and the NIO Endpoint — Which Threads Take a Connection
We follow in the source how one line of server.xml, <Connector port="8080">, becomes three objects — Connector, Http11NioProtocol and NioEndpoint — and how the Acceptor, the Poller and the worker threads share the work of a single connection inside them. With jstack and a raw-socket client we check how a keep-alive connection lets go of its thread between requests, how Tomcat's thread pool (TaskQueue) behaves differently from the JDK's, and where maxConnections, acceptCount and maxThreads take effect. We also compare with 11.0.x and see that the NIO2 connector is gone from the main branch.
-
Digging into Tomcat's Source 6: Reading an HTTP/1.1 Request — From Bytes to a coyote Request
We follow, through the real source, how bytes read from a socket are split into a request line and headers inside the service() loop of Http11Processor and become a coyote Request. By sending raw requests we also see MessageBytes, which delays making Strings, the maxHttpHeaderSize and maxHeaderCount limits, how a bad request turns into an HTML 400 page, and where keep-alive and chunked responses are decided.
-
Digging into Tomcat's Source 15: HTTP/2 and WebSocket — Protocols Reached by Upgrading
We follow, through Tomcat's source, how a connection that started as HTTP/1.1 turns into HTTP/2 or WebSocket. UpgradeProtocol and UpgradeToken, the upgrade handling in Http11Processor, Http2UpgradeHandler carrying many streams on one connection, and WebSocket's WsFilter and WsHttpUpgradeHandler, which come in through a single filter — all checked by hand with h2c requests and the JDK WebSocket client.