- Central configuration file of all web applications.
- Defines servlets, servlet filters.
From Servlet Spec
- The DD conveys the elements and configuration information of a web application between Application Developers, Application assemblers and Deployers.
- The following type of configuration and deployment information are required to be supported by a web application DD for all servlet container.
- ServletContext Init Parameters
- Session configuration
- Servlet declaration
- Servlet mappings.
- Application LifeCycle Listener class.
- Filter definition and filter mappings
- MIME type mappings
- Welcome file list
- Error page
- Locale and Encoding mappings
- Security Configurations, including login-config, security-constraint, security-role, security-role-ref, run-as.
- Web-app is the root deployment descriptor for a web application.
- The element has a required attribute version to specify to which version of the schema the deployment descriptor conforms.
- This element is to provide text describing the parent element.
- This element occurs under other multiple elements.
- This element has optional attribute xml:lang to indicate which language is used in description.
- The default value of the attribute is English("en")
- This element contains short name that intended to be displayed by tools.
- The element has optional attribute xml:lang to indicate language.
- The icon contains small-icon and large-icon element that specifies the filename for small and large GIF and JPEG images used to represent the parent element in GUI tool.
- The distributable element indicates that this Web application is programmed appropriately to deployed in distributed servlet container.
- The context-param contains the declaration of the Web application's servlet context initialization parameters.
- The filter declares a filter in Web application.
- The filter is either mapped to servlet or URL pattern in the filter-mapping element, using the filter-name value to reference.
- Filter can access the initialization parameter declared in DD at runtime via FilterConfig Interface.
- The filter-name is logical name for filter, it must be unique within the web application. It must not be empty.
- The filter-class is fully qualified class name of the filter.
- The init-param element contains name value pair as an initialization parameter of this filter.
- The optional async-supported element, when specified, indicates that the filter supports asynchronous request processing.
- The filter-mapping is used by the container to decide which filter to apply to a request in what order.
- The value of the filter-name must be one of the filter declaration in DD.
- The matching request can be URL pattern or servlet-name.
- The listener indicates the deployment properties for the application bean.
- The sub element listener-class declares that a class in application must be registered as web application listener bean.
- The servlet element is used to declare a servlet.
- It contains declarative data of servlet.
- The servlet-name element contains canonical name of the servlet, each servlet name is unique within the application. The servlet-name must not be empty.
- The servlet-class contains fully qualified class name.
- The run-as element specifies the identity to be used for the execution of a command.
- The element load-on-startup indicates that this servlet should be loaded on startup of the web application. The element content must be integer indicating the order in which servlet should be load. If the value is negative , or the element is not present, the container is free to load servlet whenever to choose. If the value is positive or 0, the container must load and initialize servlet as the application is deployed. The container must guarantee the servlet marked lower integers are loaded before servlet marked as higher integers. The container may choose the order of loading of servlet with load-on-startup value.
- If the servlet supports file upload and processing of mime-multipart request, the configuration for the same can be provided by multipart-config element, this element can be used to specify location where the file can be stored, maximum size of the file, maximum request size and size threshold.
- Defines mapping between servlet and URL pattern.
- The element defines session configuration for this web application.
- The session-timeout sub element specifies timeout interval for all session created in this web application.
- The specified timeout can be whole number of minutes.
- If the timeout is 0 or less, the default behavior of session never time out.
- It defines mapping between extension and mime type. The extension element contains a string description an extension, such as txt.
- Contains ordered list of welcome files. The sub element welcome-file contains name of the file. Default welcome is index.html
- Error page element contains mapping between error code or an extension type to the path of resource in the web application. The sup element extension type contains fully qualified class name of a Java extension type. The sub element location element contains the location of the resource in the web application relative of the web application.