Detailed element attributes
Element name |
Attribute |
Explanation |
Server |
Port |
Specifies a port for listening and disablingTomcatRequest |
Shutdown |
Specifies the command string sent to the port |
Service |
Name |
SpecifyServiceName |
Connector(Indicates the client andServiceConnection) |
Port |
Specify the port number to be created on the server and listen to requests from the client at this break. |
Minprocessors |
Number of threads created when the server is started to process requests |
Maxprocessors |
Maximum number of threads that can be created to process requests |
Enablelookups |
IfTrue, You can callRequest. getremotehost ()ProceedDNSQuery to obtain the actual Host Name of the remote client.FalseNoDNSQuery, but return itsIPAddress |
Redirectport |
The specified server is processingHTTPASSLRedirection port number after transmission request |
Acceptcount |
Specify the number of threads that can be used to process requests, and the number of requests that can be placed in the processing queue. Requests that exceed this number will not be processed. |
Connectiontimeout |
Number of times of timeout(In milliseconds) |
engine ( specifies service In the request processing machine, receives and processes from connector request ) |
defaulthost |
specify the default host name for processing requests, it must at least match the host element's name attribute values are the same |
context ( indicates a Web application Program , usually war file, about for more information about war, see servlet specification ) |
docbase |
application path or war file storage path |
Path |
Indicates thisWebApplicationURLIn this wayURLIs[Url] http: // localhost: 8080/path/[/url] ***** |
Reloadable |
This attribute is very important.True, ThenTomcatWill automatically detect the application's/WEB-INF/libAnd/WEB-INF/classesDirectory changes, automatic loading of new applications, we canTomcatChange the application |
Host(Indicates a VM.) |
Name |
Specify the Host Name |
Appbase |
The basic application directory, that is, the directory where the application is stored. |
Unpackwars |
IfTrue, ThenTomcatWill automaticallyWarDecompress the file. OtherwiseWarFile to run the application |
Logger(Indicates logs, debugging, and error messages.) |
Classname |
SpecifyLoggerThe class name used. This class must be implementedOrg. Apache. Catalina. LoggerInterface |
Prefix |
SpecifyLogFile prefix |
Suffix |
SpecifyLogFile suffix |
Timestamp |
IfTrue, ThenLogAdd time to the file name, as shown in the following example:: Localhost_log.2001-10-04.txt |
realm ( indicates the username, password, and role database ) |
classname |
specify realm class name, which must be Org. apache. catalina. realm interface |
valve ( Functions and logger is similar. Its prefix and suffix attribute explanation and ) |
classname |
specify valve class name, for example, Org. apache. catalina. valves. accesslogvalve class can record application access information |
Directory |
SpecifyLogFile storage location |
Pattern |
There are two values,CommonRemote Host Name orIPAddress, user name, date, string requested in the first line,HTTPResponseCodeThe number of bytes sent.CombinedMode RatioCommonMore record values |
Server Element It represents the entire container and is the top-level element of the Tomcat instance. by Org. apache. catalina. server interface to define. it contains a <service> element. it cannot be a child element of any element.
<ServerPort= "8005"Shutdown= "Shutdown"Debug= "0">
1> classname specifies the class that implements the org. Apache. Catalina. server interface. The default value is org. Apache. Catalina. Core. standardserver.
2> port: Specifies the port for Tomcat to listen to the shutdown command. When the server is terminated, the shutdown command must be issued on the machine where the Tomcat server is located. This attribute is required.
3> shutdown specifies the string of the shutdown listening port sent to the Tomcat server when the Tomcat server is terminated. This attribute must be set <Service> element
This element is defined by the org. Apache. Catalina. service interface. It contains one <engine> element and one or more <connector> elements that share the same engine element.
<ServiceName= "Catalina"><ServiceName= "Apache">
The first <service> process all Web client requests directly received by the Tomcat server.
The second <service> process all Web client requests forwarded by the apahce Server1> classname specifies the class that implements the org. apahce. Catalina. service interface. The default value is org. apahce. Catalina. Core. standardservice.
2> name defines the service name Engine ElementEach service element can have only one engine element. The element processes customer requests received by all <connector> elements in the same <service>. This is defined by the org. apahce. Catalina. Engine interface.
<EngineName= "Catalina"Defaulthost= "Localhost"Debug= "0">
1> classname specifies the class that implements the engine interface. The default value is standardengine.
2> defaulthost specifies the default host name for processing the customer. This host must be defined in the 3> name defines the engine name <Engine> can contain the following elements: <logger>, <realm>, <value>, and
Host Element It is defined by the host interface. An engine element can contain multiple
host name =" localhost " debug =" 0 " appbase =" webapps " unpackwars =" true " autodeploy =" true " >
1> classname specifies the class that implements the host interface. The default value is standardhost.
2> appbase: Specifies the virtual host directory. You can specify an absolute directory or a relative directory relative to <catalina_home>. If this option is not available, the default value is <catalina_home>/webapps.
3> autodeploy if this option is set to true, it indicates that when the Tomcat service is running, files under appbase can be monitored. If a new Web application is added, the Web application will be released automatically.
4> unpackwars: If this option is set to true, the war file of the Web application is expanded to an open directory structure before running. If this option is set to false, the war file is directly run.
5> alias specifies the host alias. You can specify multiple aliases.
6> deployonstartup if this option is set to true, all web applications under the appbase directory will be automatically published when the Tomcat server is started. if the server. XML does not have the corresponding <context> element. The default context of Tomcat is used.
7> name defines the name of the VM. The
Context element It is defined by the context interface. is the most frequently used element. each <context element represents a single web application running on the VM. one A corresponding context represents the web application itself. The servlet container creates a servletcontext object for the first web application.
<ContextPath= "/Sample"Docbase= "Sample"Debug= "0"Reloadbale= "True">
1> classname specifies the class that implements the context. The default value is the standardcontext class.
2> path specifies the URL entry for accessing the web application. Note/myweb instead of myweb.
3> reloadable if this property is set to true, the Tomcat server will monitor the change in the class file in the WEB-INF/classes and web-INF/lib directory while running. if a class file is updated, the server automatically reloads the web application.
3> cookies specify whether the session is supported through cookies. The default value is true.
4> usenaming specifies whether JNDI is supported. The default value is true. The <context> element can contain the following elements: <logger>, <realm>, <resource>, <resourceparams>
Connector Element
Defined by the connector interface. The <connector> element represents the deliverable that actually interacts with the customer program. It is responsible for receiving customer requests and returning response results to the customer.
< Connector Port = "8080" Maxthread = "50" Minsparethreads = "25" Maxsparethread = "75" Enablelookups = "False" Redirectport = "8443" Acceptcount = "100" Debug = "0" Connectiontimeout = "20000" Disableuploadtimeout = "True" /> < Connection Port = "8009" Enablelookups = "False" Redirectport = "8443" Debug = "0" Protocol = "AJP/1.3" />
The first connector element defines an HTTP connector, which receives HTTP requests through port 8080, and the second connector element defines a JD connector, it receives requests forwarded by other servers through port 8009. Connector element sharing attributes
1> classname specifies the class to implement the connector Interface
2> If enablelookups is set to true, domain name resolution is supported. You can resolve the IP address to the host name. In the web application, call request. getremotehost to return the client host name. The default value is true.
3> redirectport specifies the forwarding port. If the current port only supports non-SSL requests, the customer request will be forwarded to the SSL redirectport in the field requiring secure communication.
Attribute of the httpconnector Element
1> classname: class for implementing ctor
2> port: Set the TCP/IP Port. The default value is 8080. If you change 8080 to 80, you only need to enter Http: // localhost Yes, because the default port of TCP/IP is 80.
3> address: if the server has more than two IP addresses, you can set the IP address of the port listener. By default, the port listens to all IP addresses on the server.
4> buffersize: sets the cache size of the input stream created by the port. The default value is 2048 bytes.
5> set the HTTP protocol for protocol. The default value is HTTP/1.1.
6> maxthreads sets the maximum number of threads on the listening port. This value also determines the maximum number of threads that the server can respond to customer requests at the same time. The default value is 200.
7> acceptcount is set to the maximum number of customer requests in the listener port queue. The default value is 10. If the queue is full, the customer must wait.
8> connectiontimeout defines the timeout time for establishing a client connection. If the value is-1, the time for establishing a client connection is not limited.
Jkconnector attributes
1> classname: class for implementing ctor
2> set the AJP port number for Port
3> protocol must be set to AJP/1.3