Some questions about the "Apache-tomcat-5.5.15/conf/catalina/localhost configuration virtual directory." (more than one way to configure a Web project, the virtual directory is one) __web

Source: Internet
Author: User
Tags tomcat

When you are doing a Web project recently, you are always following the tomcat5.5 directory

/conf/catalina/localhost to deal with the configuration file for the project.

What is he exactly?


the information obtained from the Internet is sorted as follows:


(3) Establish the ABC catalogue under C:/tomcat 5.5/webapps/, in/conf/catalina/localhost

The following documents are established under the Sxzlc.xml,sxzlc.xml file:

<?xml version= "1.0" encoding= "UTF-8"?>


<context Path = "/SXZLC" docBase = "C:/workspace/abc/webapps"
Workdir = "/workspace/abc/work" reloadable= "true" >

</Context>

Path represents the name of the virtual directory.

DOCBASE specifies the local directory.

(Here's a specific description)

So we have a problem.


That's


How to deploy a Web project:


(This is the way I've been using it before) 1. Copy this Web application (a folder or a war file) to Appbbase, no need to write any context about the Web application anywhere, accessed by the name of the folder (or the name of the war file).
2. Put this Web application anywhere except the AppBase folder, and then write an XML file of any name (or, of course, suggest that you write an application with the same name), placed in the installation directory/server/conf/catalina/your host, in the XML file To define the access path and physical path docbase for this application, access is accessed according to the path definition.
(the 3rd is found on the Internet, no practice)
3. Add under the host node in Tomcat's Server.xml file:

Context path= "/wpoliceseeker" docbase= "C:/wpoliceseeker/webcontent"/>

about the properties of the context:


Backgroundprocessordelay This value represents the delay, in seconds, of invoking the Backgroundprocess method on the context and its child containers (including all wrappers). If the delay value is non-negative, the child container is not invoked.

This means that the child container uses its own processing thread. If the value is positive, a new thread is created. After waiting for the specified time, the thread invokes the Backgroundprocess method on the host and its child containers. Context Use background

Processing session expiration, monitoring class changes for reload. If not specified, the default value of this property is-1, which indicates that the context relies on the background processing of the host to which it belongs.


The Java class name implemented by ClassName . The class must implement the Org.apache.catalina.Context interface. If not specified, use a standard implementation (defined below).
Cookies are set to ture if they want to use cookies to pass the session identifier (requiring the client to support cookies). Otherwise, false, in which case the session identifier can only be passed by the URL rewriting.


Crosscontext If you want to call Servletcontext.getcontext () within the application to return to the request dispatcher of other Web application running on that virtual host, Set to True. In an environment where security is important

, set to False so that getcontext () always returns NULL. The default value is False.


docBase The document base directory for the Web application (document base, also known as context Root), or the path to the war file. You can use an absolute path, or you can use a appbase path relative to the host to which the context belongs.


override set to True if you want to use the settings in this context element to overwrite the corresponding settings in Defaultcontext. By default, the settings in Defaultcontext are used.

Privileged set to true to allow the context to use container servlets, such as the manager servlet.

The context path for the path Web application. Catalina compares the start of each URL to the context path and selects the appropriate Web application to process the request. The context path under a specific host must be unique. If the context path

is an empty string (""), which is the default Web application of the owning host to handle requests that cannot match any of the context path.


reloadable If you want Catalina to monitor/web-inf/classes/and/web-inf/lib The following classes change, automatically overload the WEB application when a change occurs, set to true. This feature is very much in the development phase

, but also greatly increased the cost of the server. Therefore, it is not recommended to use after release. However, you can use the manager to apply the overload that triggers the application when necessary.

Wrapperclass Org.apache.catalina.Wrapper The name of the implementation class for the servlets of the context management. If not specified, the standard default value is used.

Standard implementation


The standard implementation of the context is org.apache.catalina.core.StandardContext.

It also supports additional properties such as the following:


Attribute Description
Debug The detail level of debug information for the logger record associated with this engine. The larger the number, the more verbose the output. If not specified, the default is 0.


Swallowoutput If this value is true, the output of System.out and System.err is redirected to the logger of the Web application. If not specified, the default value is False

Usenaming set to True if you want Catalina to enable a Jndi InitialContext object for the Web application. The initialialcontext conforms to the Java Platform's Convention, and the default value is true.


Workdir The path to the temporary directory provided by the context for temporary read/write of the servlet. With the Javax.servlet.context.tempdir property, the servlet can access the directory. If not specified, use the

$CATALINA _home/work the next appropriate directory.


Nested Components
The following elements can be nested within the context element, but each element is only nested once.


Loader -Configures the class loader that the Web application uses to load the servlet and JavaBean. Normally, using the default class loader is sufficient;


L ogger -Configure the logger to receive and process all log messages, including all messages that are logged by the ServletContext.log () function;


MAnager -configure Session Manager to create, destroy, and maintain the HTTP session. Normally, using the default Session manager configuration is sufficient;


Realm -Configure Realm, the Realm user database and related roles are only used in this particular Web application. If not specified, the Web application uses the realm of the host or engine to which it belongs.


Resources-Configure to access the static resource associated with this Web application. Normally, using the default resource manager is sufficient.


Proprietary features

Access log
Under normal circumstances, running a Web server generates an access log. The access log outputs one line of information for each request in a standard format. Catalina contains an optional valve implementation that can generate logs in a standard format, and can also use any custom

's format.

By nesting a valve element in the engine, Host, or context, Catalina creates access for all requests processed by that container


The above attribute information refers to the website of teacher Sun Xin: (Programmer's Home forum)

Http://www.sunxin.org/forum/thread/23206.html



Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.