ServletContextListener (Servlet 4.0 API Documentation - Apache Tomcat 9.0.111)
Description: declaration: package: javax.servlet, interface: ServletContextListener

# Interface ServletContextListener

All Superinterfaces:
  `EventListener`

public interface ServletContextListener extends EventListener
Implementations of this interface receive notifications about changes to the servlet context of the web application they are part of. To receive notification events, the implementation class must be configured in the deployment descriptor for the web application.

Since:
  Servlet 2.3
See Also:
  - `ServletContextEvent`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `default void`
  `contextDestroyed(ServletContextEvent sce)`
  Notification that the servlet context is about to be shut down.
  `default void`
  `contextInitialized(ServletContextEvent sce)`
  Notification that the web application initialization process is starting.

- ## Method Details

  - ### contextInitialized

    default void contextInitialized(ServletContextEvent sce)
    Notification that the web application initialization process is starting. All ServletContextListeners are notified of context initialization before any filter or servlet in the web application is initialized. The default implementation is a NO-OP.
    Parameters:
      `sce` - Information about the ServletContext that was initialized

  - ### contextDestroyed

    default void contextDestroyed(ServletContextEvent sce)
    Notification that the servlet context is about to be shut down. All servlets and filters have been destroyed before any ServletContextListeners are notified of context destruction. The default implementation is a NO-OP.
    Parameters:
      `sce` - Information about the ServletContext that was destroyed