Tomcat Chinese Manual (1)

xiaoxiao2021-03-06  42

JAKARTA-Tomcat Confident Chinese User Guide Part 1

This document provides basic information about Tomcat. The main contents are as follows: Tomcat binary version installation with the main content of Tomcat related scripts related to server.xml, Tomcat's main configuration file How to set up Tomcat and host web server How to apply Tomcat Configuring a Realistic Web site I hope this document is enough to start using Tomcat. If you can't find someone, please find the Tomcat FAQ Find Tomcat Pack Refine Tomcat User Mail List Such questions do not exist, we encourage the solution to questions to Tomcat FAQ or this document. If you have any comments or suggestions for this document, please send it to Tomcat's mailing list. Getting StartedTomcat is a servlet container with JSP environments. The .servlet container is a shell that manages and activates the servlet's run according to the user's behavior. Roughly can divide the servlet container into a few categories: Separate servlet containers have part of the web server. Refer to use Java-based Web The server's case, such as the servlet container is a part of JavaWeb Server. Separate servlet container is the default mode of Tomcat. Most web servers are not based on Java, so we can draw the models of the following two containers. SERVLET container The Servlet container is a web server's plugin and the implementation of the Java container .Web server plug-in opens a JVM (Java Virtual Machine) to make Java containers internally. If a request to call servlet, the plugin will get Control of this request and deliver him (using JNI) to the Java container. Process Content For multi-threaded, single-process server is very suitable and provides a good running speed, but the scalability is insufficient. Servlet container outside the process The servlet container is running the address space other than the web server and the combination of the web server's plug-in and the implementation of the Java container .Web server plugin, and Java container JVM use IPC mechanisms (usually TCP / IP) to communicate. When a call servlet When the request arrives, the plugin will acquire the control of this request and deliver it (using IPC, etc.) to the Java container, the process export container, or the process outer container engine is not as good as the process, but the process outer container engine is in many other comparable Better (scalability, stability, etc.) in the range. Tomcat can be used as a separate container (mainly for development and commissioning) and can be added to existing servers (current support A Pache, IIS and NetScape servers. You must decide how to apply him at any time. If you choose the second or third mode, you still need to install a web server interface. What is the difference between Tomcat and JSERV? Tomcat is JServ ? This is a common misunderstanding. Jserv is compatible with the servlet API 2.0 compatible with Apache. Tomcat is a completely rewritten and container compatible with Servlet API2.2 and JSP1.1. Tomcat uses some JSERV The code, especially the Apache interface of JSERV, but this is the only thing. How to install Tomcat's binary version? Very simple, just: download zip / tar.gz any compressed file, from http: // jakarta .apche order.org / download / binindex.html. Unzip this file to a directory (such as: foo). The one son directory will be generated, named "Tomcat". Convert to "Tomcat" directory Setting up a new environment variable (Tomcat_home) Points to the Tomcat of Tomcat, type: "set tomcat_home = foo / tomcat" UNIX platform: If it is a Bash / SH environment, type: "Tomcat_home = foo / tomcat;

Export Tomcat_Home "If the TCSH environment, type:" setenv tomcat_home foo / tomcat "Set the environment variable java_home points to your JDK directory, then add the Java interpreter to your PATH environment variable. Ok! Now you can run Tomcat and as an independent Servlet Container (Mode 1) Starts with Close Tomcat Using Scripts in the "bin" directory launch and close Tomcat. Start: uinx: bin / startup.shwin32: bin / startup close: UNIX: bin / shutdown.shwin32: bin / shutdowntomcat directory Structure Hypothesis You have decompressed Tomcat, you have got the following directory structure: Directory Name - Description BIN contains Start / Close script Conf contains different profiles, including server.xml (Tomcat's primary configuration file) and for different Tomcat configurations Web Application Settings Defaults File Web.xmldoc Contains Various Tomcat Document Lib Contains Tomcat JAR Files. UNIX Platform Any files in this directory are added to Tomcat's ClassPath Logs Tomcat placed in Logs Tomcat placed in Logs Tomcat ServletAPI source files. Don't happy, these only some of the air interfaces and abstract class WebAPPs that must be implemented in the servlet container contains web project examples. Some you can create the following directory: Worktomcat automatically generates, place Tomcat Timatics (such as Compiled JSP files). If you delete this directory when you run. Thejsp page will not be able to run. Classes You can create this directory to add some additional categories to classpaths. Anything you add this directory can be Finding itself in Tomcat's class path Tomcat is a Java program, so you can run how to use the command line after setting several environment variables. However, set each environment variable used by Tomcat and the following command line parameters. And error. Therefore, Tomcat development group provides some scripts to make the startup and closing Tomcat easier. Note: These scripts are just a convenient way to start and close Tomcat. You can modify them to customize ClassPath, environment variables such as Path, LD_LIBRARY_PATH,, etc., as long as it produces a correct command line. What is these scripts? The following table lists the most important scripts for the general user. Tomcat main script. Set the appropriate environment variable, including ClassPath, Tomcat_Home and JAV A_HOME and use the appropriate command line parameter Start Tomcat Startup Start Tomcat in the background. The replacement of the Tomcat Start command Shutdown Close Tomcat. The Tomcat Stop command has a replacement method of the user's most important script is Tomcat (Tomcat.bat / Tomcat .sh). Other Tomcat-related scripts as a simple point-oriented Tomcat script (set different command line parameters, etc.). Carefully examine tomcat.bat / tomcat.sh, follows: in UNIX The step of the next step: If it is not specified, it is specified that tomcat_home is not specified, speculating java_home setting class_path contains: 1. $ {Tomcat_home} / classes directory (if present) 2. $ {Tomcat_home} / lib 3. $ {Java_home} /LIB/Tools.jar (This JAR file contains tool javac, we need JAVAC to handle the JSP file. Run the java command with the command line parameters with the setting Java environment variable, tall tomcat.home, and org.apache.tomcat. Startup.tomcat is started. At the same time, the command line parameter is also passed to org.apache.tomcat.Startup.tomcat, such as operation of start / stop / run, etc. This Tomcat process uses the path to Server.xml, such as Server. XML is placed in ETC / Server_1.xml and the user is intended to start apache in the background, type the following command line: bin / tomcat.sh start -f /etc/server_1.xml Steps under Win32:

(Omitted), Win32 version of Tomcat.Bat is almost consistent with UNIX version. In particular, it does not speculate Tomcat_Home and Java_Home value, and does not place all JAR files into class path. Tomcat configuration file Tomcat Configuring two profiles: 1.Server.xml - Tomcat global configuration file 2.Web.xml - Configuring different relationships in Tomcat This section will tell how these files will contain these files. We will not contain Web.xml interior Mechanism, these internal mechanisms go deep into the details of the Servlet API, so we will discuss the usage of servler.xml content and web.xml in the Tomcat relationship environment. Server.xml server.xml is the primary configuration file of Tomcat. Complete two Objective: 1 Provides initial configuration of Tomcat components. 2 Description Tomcat structure, meaning, so that Tomcat completes the start and build itself through instantiation components, such as the following table specified in Server.xml Description Server.xml's important elements:

转载请注明原文地址:https://www.9cbs.com/read-116977.html

New Post(0)