jump to navigation

Deployment Descriptor August 17, 2005

Posted by Coolguy in Servers.
  • The following types of configuration and deployment information are required to be supported in the Web application deployment descriptor for all servlet containers:
  • ServletContext Init Parameters
  • Session Configuration
  • Servlet Declaration
  • Servlet Mappings
  • Application Lifecyle Listener classes
  • Filter Definitions and Filter Mappings
  • MIME Type Mappings
  • Welcome File list
  • Error Pages
  • Locale and Encoding Mappings
  • Security information may also appear in the deployment descriptor
  • The following additional elements exist in the Web application deployment descriptor to meet the requirements of Web containers that are JSP pages enabled
    • Syntax for looking up JNDI objects(env-entry , ejb-ref , ejb-local-ref , re-
    source-ref , resource-env-ref
    • Syntax for specifying the message destination (message-destination , message-destination-ref )
    • Reference to a Web service (service-ref )

Rules for Processing the Deployment Descriptor

  • The deployment descriptor must be valid against the schema.
  • Web containers must remove all leading and trailing whitespace
  • In elements whose value is an enumerated type, the value is case sensitive.

Deployment Descriptor Elements

web-app Element

  • The web-app element is the root deployment descriptor for a Web application.
  • This element has a required attribute version to specify to which version of the schema the deployment descriptor conforms.
  • All sub elements under this element can be in an arbitrary order.

description Element

  • The description element is to provide a text describing the parent element.
  • This element occurs not only under the web-app element but also under other multiple elements.
  • It has an optional attribute xml:lang to indicate which language is used
    in the description.
  • E.g:
    < description>
    Servlet 2.4 Examples.
    < / description>

display-name Element

  • The display-name contains a short name that is intended to be displayed by tools.
  • The display name need not to be unique. This element has an optional attribute xml:lang to specify the language.
  • E.g:
    <display-name>Servlet 2.4 Examples

icon Element

  • The icon contains small-icon and large-icon elements that specify the file names for small and large GIF or JPEG icon images used to represent the parent element in a GUI tool.

distributable Element

  • The distributable indicates that this Web application is programmed
    appropriately to be deployed into a distributed servlet container.

context-param Element

  • The context-param contains the declaration of a Web application’s servlet
    context initialization parameters.

filter Element

  • The filter declares a filter in the Web application.
  • The filter is mapped to either a servlet or a URL pattern in the filter-mapping element, using the filter-name value to reference.
  • Filters can access the initialization parameters declared in the
    deployment descriptor at runtime via the FilterConfig interface.
  • The filter-name element is the logical name of the filter. It must be unique within the Web application.
  • filter-class is the fully qualified class name of the filter.
  • The init-param element contains name-value pair as an initialization parameter of this filter.

filter-mapping Element

  • The filter-mapping is used by the container to decide which filters to apply to a request in what order.
  • The value of the filter-name must be one of the filter declarations in the deployment descriptor.
  • The maching request can be specified either url-pattern or servlet-name.

listener Element

  • The listener indicates the deployment properties for an application listener bean.
  • The sub-element listener-class declares that a class in the application must be registered as a Web application listener bean.
  • The value is the fully qualified classname of the listener class.

servlet Element

  • The servlet is used to declare a servlet.
  • It contains the declarative data of a servlet.
  • The jsp-file element contains the full path to a JSP file within the web
    application beginning with a “/”.
  • If a jsp-file is specified and the load-on-startup element is present, then the JSP should be precompiled and loaded.
  • The servlet-name element contains the canonical name of the servlet. Each servlet name is unique within the web application.
  • The servlet-class contains the fully qualified class name of the servlet.
  • The run-as element specifies the identity to be used for the execution
    of a component.
  • The run-as element specifies the identity to be used for the execution
    of a component. It contains an optional description, and the name of a security role specified by the role-name element.
  • The element load-on-startup indicates that this servlet should be loaded (instantiated and have its init() called) on the startup of the Web application. The element content of this element must be an integer indicating the order in which the servlet should be loaded. If the value is a
    negative integer, or the element is not present, the container is free to load the servlet whenever it chooses. If the value is a positive integer or 0, the container must load and initialize the servlet as the application is deployed. The container must guarantee that servlets marked with lower integers are loaded before servlets marked with higher integers. The container may choose the order of loading of servlets with the same load-on-startup value.
  • The security-role-ref element declares the security role reference in a component’s or in a deployment component’s code. It consists of an optional description, the security role name used in the code(role-name), and an optional link to a security role(role-link). If the security role is not specified, the deployer must choose an appropriate security role.

servlet-mapping Element

  • The servlet-mapping defines a mapping between a servlet and a URL pattern.

session-config Element

  • The session-config defines the session parameters for this Web application.
  • The sub-element session-timeout defines the default session timeout interval for all sessions created in this Web application.
  • The specified timeout must be expressed in a whole number of minutes. If the timeout is 0 or less, the container ensures the default behaviour of sessions is never to time out. If this element is not specified, the
    container must set its default timeout period.

mime-mapping Element

  • The mime-mapping defines a mapping between an extension and a mime type.
  • The extension element contains a string describing an extension, such as “txt”

welcome-file-list Element

  • The welcome-file-list contains an ordered list of welcome files.
  • The subelement welcome-file contains a file name to use as a default welcome file, such as index.html

error-page Element

  • The error-page contains a mapping between an error code or an exception type to the path of a resource in the Web application.
  • The sub-element exception-type contains a fully qualified class name of a Java exception type.
  • The sub-element location element contains the location of the resource in the web application relative to the root of the web application.
  • The value of the location must have a leading ‘/’.

jsp-config Element

  • The jsp-config is used to provide global configuration information for the JSP files in a web application.
  • It has two sub-elements, taglib and jsp-propertygroup.
  • The taglib element can be used to provide information on a tag library
    that is used by a JSP page within the Web application.

security-constraint Element

  • The security-constraint is used to associate security constraints with one or more web resource collections.
  • The sub-element web-resource-collection indetifies a subset of the resources and HTTP methods on those resources within a Web application to which a security constraint applies.
  • The auth-constraint indicates the user roles that should be permitted access to this resource collection.
  • The role-name used here must either correspond to the role-name of one of the security-role elements defined for this Web application, or be the specially reserved role-name “*” that is a compact syntax for indicating all roles in the web application.
  • If no roles are defined, no user is allowed access to the portion of the Web
    application described by the containing security-constraint.
  • The container matches role names case sensitively when determining access.
  • The user-dataconstraint indicates how data communicated between the client and container should be protected by the sub-element transport-guarantee. The legal values of the transport-guarantee is either one of NONE, INTEGRAL, or CONFIDENTIAL.

login-config Element

  • The login-config is used to configure the authentication method that should be used, the realm name that should be used for this application, and the attributes that are needed by the form login mechanism.
  • The sub-element auth-method configures the authentication mechanism for the Web application. The element content must be either BASIC, DIGEST, FORM, CLIENT-CERT, or a vendor-specific authentication scheme.
  • The realm-name indicates the realm name to use in HTTP BASIC authentication
  • The form-login-config specifies the login and error pages that should be used in FORM based login. If FORM based login is not used, these elements are ignored.

security-role Element

  • The security-role defines a security role.
  • The sub-element role-name designates the name of the security role.

env-entry Element

  • The env-entry declares an application’s environment entry.
  • The sub-element env-entry-name contains the name of a deployment component’s environment entry. The name is a JNDI name relative to the java:comp/env context.The name must be unique within a deployment component
  • The env-entry-type contains the fully-qualified Java type of the environment entry value that is expected by the application’s code.
  • The sub-element env-entry-value designates the value of a
    deployment component’s environment entry. The value must be a String that is valid for the constructor of the specified type that takes a single String as a parameter, or a single character for java.lang.Character.

ejb-ref Element

  • The ejb-ref declares the reference to an enterprise bean’s home.
  • The ejb-refname specifies the name used in the code of the deployment component that is referencing the enterprise bean.
  • The ejb-ref-type is the expected type of the referenced enterprise bean, which is either Entity or Session.
  • The home defines the fully qualified name of the the referenced enterprise bean’s home interface.
  • The remote defines the fully qualified name of the referenced enterprise bean’s remote interface.
  • The ejb-link specifies that an EJB reference is linked to the enterprise

ejb-local-ref Element

  • The ejb-local-ref declares the reference to the enterprise bean’s local home.
  • The local-home defines the fully qualified name of the enterprise bean’s local home interface.
  • The local defines the fully qualified name of the enterprise bean’s
    local interface.

service-ref Element

  • The service-ref declares the reference to a Web service.
  • The service-refname declares the logical name that the components in the module use to look up the Web service
  • The service-interface defines the fully qualified class name of the
    JAX-RPC Service interface that the client depends on.
  • The wsdl-file element contains the URI location of a WSDL file.

resource-ref Element

  • The resource-ref contains the declaration of a deployment component’s
    reference to the external resource.
  • The res-ref-name specifies the name of a resource manager connection factory reference. The name is a JNDI name relative to the java:comp/env context. The name must be unique within a deployment file.
  • The res-type element specifies the type of the data source.The type is the fully qualified Java language class or the interface expected to be implemented by the data source.
  • The res-auth specifies whether the deployment component code
    signs on programmatically to the resource manager, or whether the container will sign on to the resource manager on behalf of the deployment component. In the latter case, the container uses the information supplied by the deployer.
  • The ressharing-scope specifies whether connections obtained through the given resource manager connection factory reference can be shared. The value, if specified, must be either Shareable or Unshareable.

resource-env-ref Element

  • The resource-env-ref contains the deployment component’s reference to the administered object associated with a resource in the deployment component’s environment.

message-destination-ref Element

  • The message-destination-ref element contains a declaration of deployment
    component’s reference to a message destination associated with a resource in deployment component’s environment.
  • The message-destination-link links a message destination reference or message-driven bean to a message destination

message-destination Element

  • The message-destination specifies a message destination.
  • The logical destination described by this element is mapped to a physical destination by the deployer.

locale-encoding-mapping-list Element

  • The locale-encoding-mapping-list contains the mapping between the locale and the encoding. specified by the sub-element locale-encoding-mapping.


No comments yet — be the first.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: