Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Description of the Tomcat of the Web server

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/03 Report--

1. The concept of Cpicurus S architecture and Bripple S architecture:

A, Cbig S architecture:

The client / server, the client needs to install special client software. The client is a software specially developed for a specific business.

-because the client is dedicated software, the client program generally has the ability to deal with specific business. As a result, the processing pressure on the server is reduced, and the operation speed of the server is faster and the response to the client is faster.

-it is precisely because the client needs special software that needs to be specially installed, which leads to a fatal problem in the system of Cpicurus S architecture: the cost of version upgrade is unusually high. Whether it is due to the upgrade of the function of the client software itself, or because of the upgrade of the server, the client must also upgrade, no matter what causes the client to upgrade, each client machine must first obtain the new version of the software, and then uninstall and replace the old version. For every client upgrade of Cpact S architecture system, the enterprise needs to pay the cost of manpower, material and financial resources.

B, Bax S architecture:

-browser / server, browser / server. The Client S architecture, in fact, is also a special kind of Cmax S architecture, except that this BDUA refers specifically to the browser.

-for a system based on the BPX S architecture, the client needs to have a browser installed so that the client can access the server. The upgrade of the whole system only needs to upgrade the server-side program. Therefore, the biggest advantage of the system of BBPX S architecture is that there is no client upgrade problem.

-because the client is not specifically designed for a specific business, it is a general-purpose client, so the client has almost no ability to deal with specific business. On the other hand, the processing pressure of the specific business is all added to the server, which reduces the operation speed of the server program, reduces the response speed to the client, and affects the customer experience.

-in addition, there is another problem with the Bhammer S architecture system: browser compatibility. Although the client only needs one browser to access the server, but because there are many browser brands and versions, and their implementation technologies are very different, the server needs to find a way to be compatible with various browser versions. This virtually increases the pressure on the server side.

2. Roles and protocols in Web access:

-schematic diagram of roles and protocols in Web access: (there are 4 roles, browsers, Web servers, server-side programs and DB; protocols, HTTP protocol, Servlet protocol, JDBC protocol. )

-the so-called agreement, that is, norms and rules, is the prior agreement between the two parties of the communication.

-the HTTP protocol requires that both parties, namely the browser and the server, send requests and responses in the specified format. The other party parses the information sent by the other party in accordance with the agreement, that is, the prior agreement.

-Servlet protocol requires that if a programmer wants to develop a server program to complete a specific business, he must implement the Servlet interface and use ServletAPI for data transmission.

-the JDBC protocol requires that if the server program wants to connect and operate the database, it needs to obtain the DB connection according to the way specified in the JDBC protocol (interface method), execute the SQL and obtain the result. The implementation of JDBC protocol (interface) is completed by database vendors. Just put it in the database-driven jar package provided by the database manufacturer. So, if we connect to different databases, we need to import different database-driven jar packages.

In addition, there is the JavaEE protocol: the Servlet protocol is part of the JavaEE protocol. JavaEE protocol is a set of API developed by JavaWeb, which includes Servlet protocol, JSTL protocol, JPA protocol and so on. At present, the most commonly used version is JavaEE5.0. JavaEE5.0 contains the Servlet2.5 protocol. JavaEE6.0 contains the Servlet3.0 protocol. A big difference between Servlet2.5 and Servlet3.0 is that Servlet3.0 supports annotated development of Servlet, Filter, and listener classes.

3. Description of the Tomcat of the Web server:

A, the simple understanding of Tomcat:

-in practical applications, there are many Web servers that implement the JavaEE specification, such as WebLogic of Oracle (to be purchased), WebSphere of IBM (to be purchased), JBoss of RedHat (which does not support Servlet specification, open source and free), and so on. These are all called heavyweight servers.

-Apache's Tomcat (an open source project of the Apache Software Foundation, which can be downloaded from its website http://www.apache.org/) is only the implementer of the Servlet/JSP specification in the JavaEE specification (including EL and WebSocket protocols), so it is actually a lightweight server, it is open source and free. Tomcat is also called a Web container, or a Servlet container, but cannot be called a JavaEE container.

-download pictures of the Tomcat9.0 installation package and source code package on the official website:

-an extended concept: JCP (official website is http://jcp.org), Java Community Process,Java audit community, is an open international organization, which is mainly responsible for standardizing and supervising the development of Java. Java specifications formulated by other individuals, enterprises and institutions must be audited by JCP before they can be recognized as Java specifications. The founder of JCP is SUN.

B. Installation and directory structure of Tomcat:

-the installation of Tomcat can be unzipped without a wizard installation process. After unzipping, you can rename the root directory of Tomcat.

C. Running environment configuration of Tomcat:

-after Tomcat is installed, you need to install JDK or JRE. For Tomcat5 and previous versions, it is required that JDK must be installed, while for Tomcat6 and later versions, only JRE can be installed without JDK.

-configure the system environment variable JAVA_HOME when installing JDK and add its bin directory to the path variable. (no additional configuration is required for Tomcat)

-if the system environment variable is not configured, the following error is displayed on the command line:

D. Startup and access of Tomcat:

-after setting the previous environment variables, Tomcat can start.

-go to the bin directory of the Tomcat directory in the command line window, execute the startup.bat command, and you can see the startup process of Tomcat. Of course, you can also find the bin directory of the Tomcat directory in the Window window, and double-click the startup.bat file directly to start Tomcat. (the shutdown.bat file closes Tomcat)

-you can access the Tomcat by typing localhost:8080 on the browser's address bar.

4. The JavaEE specification requires that the program structure of the JavaWeb project is:

-you can store resource files, such as .html, .jpg, etc., directly in the directory where the current application is located, or you can access them in a subdirectory.

-if the Web project contains Serlvet code, the bytecode file of Servlet must be stored in the subdirectory / WEB-INF/classes of the current application.

-you can include web.xml configuration files under / WEB-INF/, define the mapping between the request URI and the Serlvet to be accessed, specify the welcome page, and so on.

-you can include a subdirectory lib under / WEB-INF, which is used to store external jar packages used by the current Web application.

-the resources in the / WEB-INF/ directory cannot be accessed directly by the browser.

-as follows:

-Project root directory

-html, jsp, js, css, jpg and other resource files

-subdirectory

-related resource files

-WEB-INF

-classes

-lib

-web.xml

-html, jsp and other resource files

5. Interpret the server.xml file:

6. Context.xml description and Context tag explanation in Tomcat:

A. Before tomcat5.5: Context is embodied in the element in Host in / conf/server.xml, which is defined by the Context interface. Each element represents a single Web application running on a virtual host.

-server.xml files, such as.

-path represents the virtual directory to be created, and it specifies the context root to access the Web application, such as http://localhost:8080/kaka/... docBase: the path for the application or the path where the WAR file is stored, either absolute or relative.

-reloadable: if this property is set to true,Tomcat server in running state, it will monitor the changes of class files in WEB-INF/classes and WEB-INF/lib directories, and if it monitors that class files have been updated, the server will automatically reload Web references, so that we can change the application without restarting tomcat.

-any number of Host elements are nested within a Context element. The path to each Context must be unique, defined by the path attribute. In addition, you must define a Context for path= "", which Context calls the default web application for the virtual host, to handle requests that cannot match the Context path of any Context.

B. After tomcat5.5:

-it is not recommended to configure in server.xml, but independently in / conf/context.xml. Because server.xml is a resource that cannot be dynamically reloaded, once the server is started, to modify this file, the server must be restarted before it can be reloaded. This is not the case with the context.xml file, which is regularly scanned by the tomcat server. Once the file is found to have been modified (the timestamp changed), the file is automatically reloaded without the need to restart the server.

-as follows:

WEB-INF/web.xml WEB-INF/kaka.xml monitors the resource file. If web.xml | | kaka.xml changes, the application will be reloaded automatically. Represents the database URL address

C, appendix: three areas of action of context.xml:

-tomcat server level: configured in / conf/context.xml.

-Host level: at / conf/Catalina/$ {webAppName} .xml, then configure.

-web app level: add ${webAppName} .xml to / conf/Catalina/$ (hostName}) and then configure it.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report