# Class WsContextListener

java.lang.Object
org.apache.tomcat.websocket.server.WsContextListener

All Implemented Interfaces:
  `EventListener, ServletContextListener`

public class WsContextListener extends Object implements ServletContextListener
In normal usage, this `ServletContextListener` does not need to be explicitly configured as the `WsSci` performs all the necessary bootstrap and installs this listener in the `ServletContext`. If the `WsSci` is disabled, this listener must be added manually to every `ServletContext` that uses WebSocket to bootstrap the `WsServerContainer` correctly.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `WsContextListener()`
  Constructs a new WsContextListener.

- ## Method Summary

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

  ### Methods inherited from class Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### WsContextListener

    public WsContextListener()
    Constructs a new WsContextListener.

- ## Method Details

  - ### contextInitialized

    public void contextInitialized(ServletContextEvent sce)
    Description copied from interface: `javax.servlet.ServletContextListener`
    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.
    Specified by:
      `contextInitialized` in interface `ServletContextListener`
    Parameters:
      `sce` - Information about the ServletContext that was initialized

  - ### contextDestroyed

    public void contextDestroyed(ServletContextEvent sce)
    Description copied from interface: `javax.servlet.ServletContextListener`
    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.
    Specified by:
      `contextDestroyed` in interface `ServletContextListener`
    Parameters:
      `sce` - Information about the ServletContext that was destroyed