Friday, June 1, 2007

Web Application Deployment Descriptor

All servlet containers that are compliant with the 2.3 servlet specification are required to support the following types of deployment information:

Initialization parameters
Session configuration
Servlet declarations
Servlet mappings
Application lifecycle listener classes
Filter definitions and mappings
Welcome file list
Error pages

Optional:

Tag library mappings
JNDI References

When a web application is installed in a container, the container is responsible for assigning a ServletContext to it. There is a single instance of a ServletContext object for each web application depolyed in a container.

The ServletContext provides an external view of the web container environment for a servlet. A servlet can use the ServletContext object to gain access to external resources, log events, and store attributes and objects that other servlet instances in the same context can access. It's essentially an application-scope shared resource.

Because a servlet is associated with a specific web application, all requests that begin with a specific request path (known as the context path) are routed to the web application associated with that servlet. Servlets associated with the default application have an empty string ("") as the context path.




Application events provide notifications of a change in state of the servlet context (Each web application uses its own servlet context) or of an HTTP session object.

You write event listener classes that respond to these changes in state, and you configure and deploy them in a Web applicatioin. The servlet container generates events that cause the event listener classes to do something. In other words, the servlet container calls the methods on a user's event listener class.

No comments: