Chapter 5: Basic Tomcat Confi guration This concludes

Chapter 5: Basic Tomcat Confi guration This concludes the coverage of Context descriptor and the system default context.xmlfile in the $CATALINA_HOME/confdirectory. Authentication and the tomcat-users.xml File Another configuration file found in the $CATALINA_HOME/conf directory is tomcat-users.xml . The tomcat-users.xml file is used by Tomcat 6 to authenticate manager tool users. Tomcat 6 makes use of a UserDatabase Realm component to accomplish this. The UserDatabase Realm enables modification of the loaded data and can properly persist (write back to the XML file) any changes made to the data. Only users assigned to role manager will be able to access the managerapplication. The Default Deployment Descriptor web.xml According to the Servlet 2.5 specification, every Web application should include a deployment descriptor (web.xmlfile). This file must be placed in the WEB-INF/ directory of the Web application and so is specific to just that Web application. There is also a web.xmlfile under the $CATALINA_HOME/conf directory. This file is similar to a Web application s web.xml file. However, this particular web.xml file is used to specify the default properties for all Web applications that are running within this server instance. Be very careful when making modifications to this file (such as any additions or changes) because they affect all Web applications running on the same server instance. Note also that other application servers may or may not support a global default web.xml, as this is not a requirement for Servlet 2.5 standard compliance. It is time to see what default server-wide properties are configured in this web.xml file. First, there is the standard XML header and a reference to the Servlet 2.4 schema (Tomcat 6 is Servlet 2.5 compliant, but as of this writing, the global web.xmluses the Servlet 2.4 schema). Unlike server.xml, web.xml can be formally validated against a schema: The Servlet 2.4 schema provides a significantly more rigorous mechanism for document validation than the DTD used in earlier specifications. Chapter 7 provides a detailed discussion of the Servlet 2.4 and 2.5 schemas. Configuring the Default Servlet for Static Resources In the following definition, a default servlet is specified. This default servlet is used to serve any static resources (static HTML files, GIF files, and so on) within all Web applications, and also to serve directory listings (if it is enabled; see the following listing). In other words, this default servlet provides equivalent capability to a standard Web server. In fact, when using Tomcat in the standalone mode of operation, it is the default servlet that handles static resources. The following segment in the web.xml file configures this default servlet: default

For high quality java hosting services please check tomcat web hosting website.

Comments are closed.