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. Example of Web Deployment Descriptors
  4. Tips

Principles

The Web component programmer is responsible for providing the deployment descriptor associated to the developed web components. As one goes along the different steps of the application development and deployment life cycle of the Web components, (development, assembly, deployment), the deployment descriptor has to be completed.

The Web component provider's responsibilities and the Application Assembler's responsibilities is to provide a XML deployment descriptor respecting the deployment descriptor's XML DTD defined in the Java TM Servlet Specification Version 2.3. (See $JONAS_ROOT/xml/web-app_2_3.dtd).

To be able to customize the Web components, informations not defined in the standard XML deployment descriptor may be needed. Such information includes for example 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, which is specific to JOnAS. The JOnAS specific deployment descriptor's XML DTD can be found 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-'.

The JOnAS interpretation of the <!DOCTYPE> tag is particular, at the parsing of the deployment descriptor XML files.
The parser try, first, to get the specified DTD via the classpath, and then via the specified URL (or path).

Examples: in these two following examples, the parser get the jonas-web-app_2_6.dtd DTD file via the URL or in the /usr/local/jonas/xml/ directory.

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

The standard deployment descriptor (web.xml) should contain structural information including:

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

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

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

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

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

Example of Web Deployment Descriptors

Tips

Some characters, such "<" and "&" are strictly illegal in the XML data.
Others, such ">", are legal, but it is a good habit to replace them by XML entity references.

Here is the list of the predefined entity references in XML:

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