Apache Tomcat is a long-lived, open source Java servlet container that implements core Java enterprise (now Jakarta EE) specifications, including the Jakarta Servlet, Jakarta Server Pages, and Jakarta WebSocket specs.
Tomcat was first released by the Apache Software Foundation in 1998, just four years after Java itself. Tomcat started as the reference implementation for the original Java Servlet API and JavaServer Pages specification. Today, it remains the most widely used Java application server, boasting a well-tested and proven core engine with good extensibility.
In this short introduction, you’ll learn why many developers choose Tomcat for running Java web applications. You’ll get an overview of Tomcat and how it’s used, installation instructions, and a brief guide to the four ways to deploy a Java application using Tomcat.
Is Tomcat an app server or a web server?
The Java ecosystem supports several kinds of application server:
- A servlet container is an implementation of the Jakarta Servlet specification, used primarily for hosting servlets.
- A web server is a server designed to serve files from the local system, like Apache.
- A Java enterprise application server is a full-blown implementation of the Jakarta EE specification.
At heart, Tomcat is a servlet and JSP container:
- A Java (or Jakarta) servlet defines endpoints for HTTP requests and routes them to business logic code for handling.
- JSP, or Jakarta Server Pages, is a server-side view-rendering technology that allows defining HTML interfaces using data from inside the server and information from the request and response. As the developer, you write the servlet or JSP page, define rules for the requests and responses, then let Tomcat handle the routing.
Tomcat also contains the Coyote web server. Coyote makes it possible to use Tomcat to serve static files in combination with Apache web server (more about that shortly).
An extended version of Tomcat, called TomEE, includes a wider variety of Jakarta specifications and capabilities, including the Jakarta Persistence API. (TomEE is Jakarta Web Profile 9.1 certified.)
Next, we’ll look at how to use Tomcat to host servlets and JSPs.
Download and install Tomcat
Being a hoary ancient of the software world, Tomcat has several active versions available. For most purposes, you can just use the latest stable version.
To get started, download the latest version of Tomcat. You’ll have a choice of downloading Tomcat as an archive (.zip or tar.gz), or as an installed service. The best choice is up to you unless you are not running on Windows, in which case you’ll go for the archive. We’ll use the archive for this article.
You can also download the archive at the command line with a tool like wget
. In this case, you’d just enter a command like
wget
where <VER> is the version you want.
This story, “What is Tomcat? The original Java servlet container” was originally published by
Copyright © 2022 IDG Communications, Inc.
Source : https://www.infoworld.com/article/3510460/what-is-apache-tomcat-the-original-java-servlet-container.html#tk.rss_all