Class JavaxWebSocketShutdownContainer

  • All Implemented Interfaces:
    java.util.EventListener, javax.servlet.ServletContainerInitializer, javax.servlet.ServletContextListener, Container, Destroyable, Dumpable, Dumpable.DumpableContainer, LifeCycle

    public class JavaxWebSocketShutdownContainer
    extends ContainerLifeCycle
    implements javax.servlet.ServletContainerInitializer, javax.servlet.ServletContextListener

    This manages the LifeCycle of WebSocketContainer instances that are created with ContainerProvider, if this code is being run from another ServletContainer, or if run inside a Jetty Server with the WebSocket client classes provided by the webapp.

    This mechanism will not work if run with embedded Jetty or if the WebSocket client classes are provided by the server. In this case then the client WebSocketContainer will register itself to be automatically shutdown with the Jetty ContextHandler.

    • Constructor Detail

      • JavaxWebSocketShutdownContainer

        public JavaxWebSocketShutdownContainer()
    • Method Detail

      • onStartup

        public void onStartup​(java.util.Set<java.lang.Class<?>> c,
                              javax.servlet.ServletContext ctx)
                       throws javax.servlet.ServletException
        Specified by:
        onStartup in interface javax.servlet.ServletContainerInitializer
      • contextInitialized

        public void contextInitialized​(javax.servlet.ServletContextEvent sce)
        Specified by:
        contextInitialized in interface javax.servlet.ServletContextListener
      • contextDestroyed

        public void contextDestroyed​(javax.servlet.ServletContextEvent sce)
        Specified by:
        contextDestroyed in interface javax.servlet.ServletContextListener