Defining the Web Deployment Descriptor

Target Audience and Content

The target audience for this guide is the Web component provider, i.e. the person in charge of developing the Web components on the server side. It describes how the Web component provider should build the deployment descriptors of its Web components.

The content of this guide is the following:

  1. Target Audience and Content
  2. Principles
  3. Examples of Web Deployment Descriptors
  4. Tips

Principles

The Web component programmer is responsible for providing the deployment descriptor associated with the developed web components. The Web component provider's responsibilities and the application assembler's responsibilities are to provide an XML deployment descriptor that conforms to the deployment descriptor's XML DTD as defined in the Java TM Servlet Specification Version 2.3. (Refer to $JONAS_ROOT/xml/web-app_2_3.dtd).

To customize the Web components, information not defined in the standard XML deployment descriptor may be needed. For example, the information may include the mapping of the name of referenced resources to its JNDI name. This information can be specified during the deployment phase, within another XML deployment descriptor that is specific to JOnAS. The JOnAS-specific deployment descriptor's XML DTD is located in $JONAS_ROOT/xml/jonas-web-app_X_Y.dtd. The file name of the JOnAS-specific XML deployment descriptor must be the file name of the standard XML deployment descriptor prefixed by 'jonas-'.

JOnAS interprets the <!DOCTYPE> tag at the parsing of the deployment descriptor XML files.
The parser first tries to get the specified DTD via the classpath, then it uses the specified URL (or path).

In the two following examples, the parser gets the jonas-web-app_3_1.dtd DTD file via the URL or in the /usr/local/jonas/xml/ directory.

    <!DOCTYPE jonas-web-app PUBLIC "-//ObjectWeb//DTD JOnAS Web App 3.1//EN" "http://www.objectweb.org/jonas/dtds/jonas-web-app_3_1.dtd">
    <!DOCTYPE jonas-web-app SYSTEM "/usr/local/jonas/xml/jonas-web-app_3_1.dtd">
    

The standard deployment descriptor (web.xml) should contain structural information that includes the following:

The JOnAS-specific deployment descriptor (jonas-web.xml) may contain information that includes:

<host> element: If the configuration file of the web container contains virtual hosts, the host on which the WAR file is deployed can be set.

<context-root> element: The name of the context on which the application will be deployed should be specified. If it is not specified, the context-root used can be one of the following:

If the context-root is / or empty, the web application is deployed as ROOT context (i.e., http://localhost:8080/).

<java2-delegation-model> element: Set the compliance to the java 2 delegation model.

Examples of Web Deployment Descriptors

Tips

Although some characters, such as ">", are legal, it is good practice to replace them with XML entity references. The following is a list of the predefined entity references for XML:

&lt; < less than
&gt; > greater than
&amp; & ampersand
&apos; ' apostrophe
&quot; " quotation mark