Thursday, 7 February 2013

Web Application Deployment Descriptor | Servlets Tutorial pdf

Web Application Deployment Descriptor

The Web application deployment descriptor ( “Deployment Descriptor”) includes the following types of  configuration and deployment information:
=> ServletContext Init Parameters
=> Session Configuration
=> Servlet/JSP Definitions
=> Servlet/JSP Mappings
=> MIME Type Mappings
=> Welcome File list
=> Error Pages
=> Security

Dependencies On Extensions

When a number of applications make use of the same code or resources, they will typically be installed as library files in the container. These files are often common or standard APIs that can be used without sacrificing portability. Files used only by one or a few applications will be made available for access as part of the Web application. The container must provide a directory for these libraries. The files placed within this directory must be available across all Web applications. The location of this directory is container-specific. The class loader the servlet container uses for loading these library files must be the same for all Web applications within the same JVM. This class loader instance must be somewhere in the chain of parent
class loaders of the Web application class loader.
Application developers need to know what extensions are installed on a Web container, and containers need to know what dependencies servlets in aWAR have on such libraries in order to preserve portability.
J2EE technology-compliant containers are required to provide a mechanism by which a deployer can learn what JAR files containing resources and code are available for the Web application. Providing such the mechanism is recommended, but not required for the containers that are not part of J2EE technology-compliant implementation. The containers should provide a convenient procedure for editing and configuring library files or extensions.
The application developer depending on such an extension or extensions must provide a  META-INF/MANIFEST.MF entry in the WAR file listing all extensions needed by theWAR. The format of the manifest entry should follow standard JAR manifest format. During deployment of the Web application, the Web container must make the correct versions of the extensions available to the application following the rules defined by the Optional Package Versioning mechanism (http:/ /java.sun.com/j2se/1.4/docs/guide/extensions/).
Web containers must also be able to recognize declared dependencies expressed in the manifest entry of any of the library JARs under the WEB-INF/lib entry in a WAR.
If a Web container is not able to satisfy the dependencies declared in this manner, it should reject the application with an informative error message.

Web Application Class Loader

The class loader that a container uses to load a servlet in a WAR must allow the developer to load any resources contained in library JARs within the WAR following normal J2SE semantics using getResource. As described in the J2EE license agreement, servlet containers that are not part of a J2EE product should not
allow the application to override J2SE platform classes, such as those in the java.* and javax.* namespaces, that J2SE does not allow to be modified. Also, servlet containers that are part of a J2EE product should not allow the application to override J2SE or J2EE platform classes, such as those in java.* and javax.* namespaces, that either J2SE or J2EE do not allow to be modified. The container should not allow  applications to override or access the container’s implementation classes. It is recommended also that the application class loader be implemented so that classes and resources packaged within the WAR are loaded in preference to classes and resources residing in container-wide library JARs.

No comments: