Tomcat is an HTTP server. Tomcat is also a container that can execute Java Servlet, and converting JavaServer Pages (JSP) and JavaServerFaces (JSF) to Java Servlet. Tomcat consist of nested component hierarchy. Mainly tomcat server consist of 6 components which are
The main configuration file of tomcat server is server.xml.From the server.xml you can done the configuration of above components. The tag structure of a server.xml file looks like follows
<Server> <Service> <Connector /> <Engine> <Host> <Context> </Context> </Host> </Engine> </Service> </Server>
The following diagram gives a clear architectureal explanation about tomcat server on the basis of above components
Lets have a brief look on components in tomcat
Server
Tomcat itself is known as the server. Also it is the top level component in tomcat. It owns a port that is used to shut down the server. In addition, the Server can be set in debug mode, which instantiates a version of the Java Virtual Machine (JVM) that enables debugging.
Separate Servers configured to different ports can be set up on a single machine to separate applications so that they can be restarted independently. That is, if one Server running in a JVM were to crash, the other applications would be safe in another Server instance. This is sometimes done in hosting environments in which each customer has a separate instance of a JVM, so a badly configured/written application will not cause others to crash.
Service
Each Service represents a grouping of Connectors (components that manage the connection between the client and server) and a single container, which accepts requests from the Connectors and processes the requests to present them to the appropriate Host. Each Service is named so that administrators can easily identify log messages sent from each Service.
Each Service represents a grouping of Connectors (components that manage the connection between the client and server) and a single container, which accepts requests from the Connectors and processes the requests to present them to the appropriate Host. Each Service is named so that administrators can easily identify log messages sent from each Service.
Connectors
Connectors connect the applications to clients. They represent the point at which requests are received from clients and are assigned a port on the server. Multiple Connectors may be set up for a single Engine or Engine-level component, but they must have unique port numbers. The default Connector is Coyote, which implements HTTP 1.1. Alternative Connectors are Apache JServ Protocol (AJP), an SSL Connector for secure connections, and an HTTP 1.0 Connector.
Engine
In tomcat a container object that cannot be contained by another container. This means that it is guaranteed not to have a parent container. It is at this level that the objects begin to aggregate child components.
In practice, the container at this level is usually an Engine and so it makes sense to discuss it in that role. As mentioned previously, an Engine is a request-processing component that represents the Catalina Servlet engine. It examines the HTTP headers to determine the virtual host or context to which requests should be passed.
When the standalone configuration is used, the Engine that is used is the default one. This Engine does the checking mentioned earlier. When Tomcat is configured to provide Java Servlet support for a Web server, the default class used to serve requests is overridden because the Web server has normally deter- mined the correct destination of the request.
The Host
Host mimics the popular Apache virtual host functionality. In Apache, this enables multiple servers to be used on the same machine, and to be differentiated by their IPaddress or by their host name. In Tomcat, the virtual hosts are differentiated by a fully qualified host name. Thus, the two Web sites www.websitea.com and www.websiteb.com can both reside in the same server, with requests for each routed to different groups of Web applications.
Configuring a Host includes setting the name of the host. The majority of clients can be depended on to send both the IP address of the server and the host name they used to resolve the IP address. The host name is provided as an HTTP header that an Engine inspects to determine the Host to which a request should be passed.
The Context
Finally, there is the Web application, also known as a context. Configuration of a Web application includes informing the Engine/Hosts of the location of the root folder of the application. Dynamic reloading can also be enabled so that any classes that have been changed are reloaded into memory. However, this is resource-intensive, and is not recommended for deployment scenarios.
The context may also include specific error pages, which enable a system administrator to configure error messages that are consistent with the look and feel of the application, and usability features (such as a search Engine, useful links, or a report-creating component that notifies the administrator of errors in the application).
No comments:
Post a Comment