HTTP Connectors

by Jeff Hunter, Sr. Database Administrator


When you use Tomcat out of the box to run web applications, it is able to serve HTML pages without any additional configuration. The reason this works is because it comes configured with an HTTP connector that can handle requests from a user's web browser. Because of this connector, Tomcat can function as a standalone web server, and serve static HTML pages in addition to handling servlets and JSP pages.

Tomcat connectors provide the external interface (over HTTP or HTTPS) to Tomcat clients. There are two kinds of connectors - that that implement an HTTP stack of their owner (called HTTP connectors) and those that tie Tomcat to an external web server like Apache or IIS (called web server connectors).

The following are the HTTP Connectors that come with Tomcat:

Tomcat Server Connector Implementation / Name Description
Tomcat 3.x HTTP/1.0 Connector Came standard and configured with Tomcat 3.x.
Tomcat 4.0 and 4.1 HTTP/1.1 Connector Came standard with 4.0 and 4.1. In Tomcat 4.0, this was the default connector.
Tomcat 4.1 Coyote HTTP Connector This is the default connector for Tomcat 4.1. This connector will soon obsolete both connectors defined above: HTTP/1.0 and HTTP/1.1. It will also be backwards compatible with both Tomcat 4.x and Tomcat 3.x.

Defining the HTTP Connectors used with Tomcat

The HTTP connectors are Java classes that implement the HTTP protocol. Tomcat 3.x's connector class (org.apache.tomcat.modules.server.Http10Inteceptor) is invoked when there is an HTTP request on the connector port. The port that the connector listens on is specified in the $TOMCAT_HOME/conf/server.xml configuration file, and is usually set to Port 8080. The connector class has code to parse the HTTP request, and take the required action of either serving up static content or passing the request through the Tomcat servlet engine. This connector class implements the HTTP/1.0 protocol.

The corresponding connectors in Tomcat 4.x are the HTTP/1.1 (org.apache.catalina.connector.http.HttpConnector) and the Coyote HTTP/1.1 connector (org.apache.coyote.tomcat4.CoyoteConnector). Both of these implement the HTTP/1.1 protocol like the Tomcat 3.x connector and listen on the connector port for incoming HTTP requests.

Last modified on: Saturday, 18-Sep-2010 18:05:04 EDT
Page Count: 8064