Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

Web Technologies: Apache Tomcat

Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 34

Web Technologies

Apache Tomcat

Wasif Hamdani
Apache Tomcat

Apache Tomcat is a web container which allows to


run servlet and JavaServer Pages (JSP) based web
applications.

Most of the modern Java web frameworks are based


on servlets, e.g. Java Server Faces, Struts, Spring.

2
Apache Tomcat

The Apache Tomcat software is an open source


implementation of the Java Servlet, JavaServer Pages,
Java Expression Language and Java Web Socket
technologies.

Apache Tomcat is a web server and servlet


container that is used to deploy and serve Java web
applications.

3
Apache Tomcat

Apache Tomcat?

https://
www.youtube.com/watch?v=FVyX8WA8Ng4

4
Apache Tomcat

Tomcat Architecture

5
Apache Tomcat

6
Apache Tomcat

– Server
– Service

– Engine
– Host
– Connector
– Context

7
Apache Tomcat
Server

– In the Tomcat world, a Server represents the whole


container.

– Tomcat provides a default implementation of the


Server interface.

8
Apache Tomcat
Service

– A Service is an intermediate component which lives


inside a Server and ties one or more Connectors to
exactly one Engine.

– The Service element is also rarely customized by


users, as the default implementation is simple and
sufficient: Service interface.

9
Apache Tomcat
Engine
– An Engine represents request processing pipeline for
a specific Service.
– As a Service may have multiple Connectors, the
Engine received and processes all requests from
these connectors, handing the response back to the
appropriate connector for transmission to the client.
– The Engine interface may be implemented to supply
custom Engines, though this is uncommon.
– The Engine may be used for Tomcat server clustering
via the jvmRoute parameter.

10
Apache Tomcat
Host
– A Host is an association of a network name, e.g.
www.yourcompany.com, to the Tomcat server.

– An Engine may contain multiple hosts, and the Host


element also supports network aliases such as
yourcompany.com and abc.yourcompany.com.

– Users rarely create custom Hosts because the


Standard Host implementation provides significant
additional functionality.
11
Apache Tomcat
Connector
– A Connector handles communications with the client.

– There are multiple connectors available with Tomcat,


all of which implement the Connector interface.

– These include the Coyote connector which is used for


most HTTP traffic, especially when running Tomcat as
a standalone server, and the JK2 connector which
implements the AJP protocol used when connecting
Tomcat to an Apache HTTPD server.
12
Apache Tomcat
Context
– A Context represents a web application.

– A Host may contain multiple contexts, each with a


unique path.

– The Context interface may be implemented to create


custom Contexts, but this is rarely the case because
the StandardContext provides significant additional
functionality.

13
Apache Tomcat
Components and Features of Apache Tomcat

• Apache Tomcat has following components and


features to manage web applications.
– Catalina
– Coyote
– Jasper
– Cluster
– High Availability
– Web Application

14
Apache Tomcat
Catalina
– Catalina is Tomcat's servlet container.

– Catalina implements Sun Microsystems' specifications


for servlet and JavaServer Pages (JSP).

– In Tomcat, a Realm element represents a "database" of


usernames, passwords, and roles (similar
to Unix groups) assigned to those users.

15
Apache Tomcat
Catalina
– Different implementations allow Catalina to be
integrated into environments where such
authentication information is already being created
and maintained.

– Then use that information to implement Container


Managed Security as described in the Servlet
Specification.

16
Apache Tomcat
Coyote
– Coyote is a Connector component for Tomcat that
supports the HTTP 1.1 protocol as a web server.

– This allows Catalina, nominally a Java Servlet or JSP


container, to also act as a plain web server that serves
local files as HTTP documents.

– Coyote listens for incoming connections to the server


on a specific TCP port and forwards the request to the
Tomcat Engine to process the request and send back a
response to the requesting client.
17
Apache Tomcat
Coyote
– Another Coyote Connector, Coyote JK, listens
similarly but instead forwards its requests to another
web server, such as Apache, using the JK Protocol.

– This usually offers better performance.

18
Apache Tomcat
Jasper
– Jasper is Tomcat's JSP Engine. Jasper parses JSP files to
compile them into Java code as servlets (that can be
handled by Catalina).

– At runtime, Jasper detects changes to JSP files and


recompiles them.

– As of version 5, Tomcat uses Jasper 2, which is an


implementation of the Sun Microsystems' JSP 2.0
specification.
19
Apache Tomcat
Jasper
From Jasper to Jasper 2, important features were
added:
– JSP Tag library pooling – Each tag markup in JSP file is
handled by a tag handler class.

– Tag handler class objects can be pooled and reused in


the whole JSP servlet.

– Background JSP compilation – While recompiling


modified JSP Java code, the older version is still
20
available for server requests.
Apache Tomcat
Jasper
– The older JSP servlet is deleted once the new JSP
servlet has finished being recompiled.
– Recompile JSP when included page changes – pages
can be inserted and included into a JSP at runtime.
– The JSP will not only be recompiled with JSP file
changes but also with included page changes.
– JDT Java compiler – Jasper 2 can use the Eclipse JDT
(Java Development Tools) Java compiler instead of Ant
and javac.

21
Apache Tomcat
Cluster
– This component has been added to manage large
applications.

– It is used for load balancing that can be achieved


through many techniques. Clustering support currently
requires the JDK version 1.5 or higher.

– Load balancing refers to the process of distributing a


set of tasks over a set of resources (computing units),
with the aim of making their overall processing more
efficient.
22
Apache Tomcat
High Availability
– A high-availability feature has been added to facilitate
the scheduling of system upgrades (e.g. new releases,
change requests) without affecting the live
environment.

– This is done by dispatching live traffic requests to a


temporary server on a different port while the main
server is upgraded on the main port.

– It is very useful in handling user requests on high-


traffic web applications.
23
Apache Tomcat
Web Application
– It has also added user as well as system-based web
applications enhancement to add support for
deployment across the variety of environments.

– Also tries to manage sessions as well as applications


across the network.

24
Apache Tomcat

Apache Tomcat Components

https://www.youtube.com/watch?v=sShmhvnuRYs

25
Apache Tomcat
Top Level Elements

• Server

• Service

26
Apache Tomcat
Server
– A Server element represents the entire Catalina servlet
container.

– Therefore, it must be the single outermost element in


the conf/server.xml configuration file.

– Its attributes represent the characteristics of the


servlet container as a whole.

27
Apache Tomcat

28
Apache Tomcat
Service
– A Service element represents the combination of one
or more Connector components that share a single
Engine component for processing incoming requests.

– One or more Service elements may be nested inside a


Server element.

29
Apache Tomcat

30
Apache Tomcat
Apache HTTP Server Vs Apache Tomcat Server

– Apache Tomcat is used to deploy Java Servlets and


JSPs.

– So, basically Apache is an HTTP Server, serving HTTP.

– Tomcat is a Servlet and JSP Server serving Java


technologies. Tomcat includes Catalina, which is a
servlet container.

31
Apache Tomcat
Apache HTTP Server Vs Apache Tomcat Server

32
Question(s)?

33
Thank you 

34

You might also like