Servlet Context Interface

The ServletContext interface defines a servlet’s view of the Web application within which the servlet is running. The Container Provider is responsible for providing an implementation of the ServletContext interface in the servlet container. Using the ServletContext object, a servlet can log events, obtain URL references to resources, and set and store attributes that other servlets in the context can access. A ServletContext is rooted at a known path within a Web server. For example, a servlet context could be located at http://www.mycorp.com/catalog. All requests that begin with the /catalog request path, known as the context path, are routed to the Web application associated with the ServletContext.

  • Scope of a ServletContext Interface
  • Initialization Parameters
  • Context Attributes
  • Resources
  • Multiple Hosts and Servlet Contexts
  • Reloading Considerations