Top Description Fields Constructors Methods
org.eclipse.jetty.ee10.websocket.jakarta.client.webapp

public Class JakartaWebSocketShutdownContainer

extends ContainerLifeCycle
implements ServletContainerInitializer, ServletContextListener
Class Inheritance
All Implemented Interfaces
jakarta.servlet.ServletContextListener, java.util.EventListener, jakarta.servlet.ServletContainerInitializer
Imports
java.util.Set, jakarta.servlet.ServletContainerInitializer, .ServletContext, .ServletContextEvent, .ServletContextListener, .ServletException, org.eclipse.jetty.ee10.websocket.jakarta.client.JakartaWebSocketClientContainer, org.eclipse.jetty.util.component.ContainerLifeCycle, .LifeCycle, org.slf4j.Logger, .LoggerFactory

This manages the LifeCycle of jakarta.websocket.WebSocketContainer instances that are created with jakarta.websocket.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 jakarta.websocket.WebSocketContainer will register itself to be automatically shutdown with the Jetty ContextHandler.

Field Summary

Modifier and TypeField and Description
private static final Logger

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public void
contextDestroyed(ServletContextEvent
the ServletContextEvent containing the ServletContext that is being destroyed
sce
)

Overrides default jakarta.servlet.ServletContextListener.contextDestroyed.

Receives notification that the ServletContext is about to be shut down.

public void
contextInitialized(ServletContextEvent
the ServletContextEvent containing the ServletContext that is being initialized
sce
)

Overrides default jakarta.servlet.ServletContextListener.contextInitialized.

Receives notification that the web application initialization process is starting.

public void
onStartup(Set<Class<?>>
the Set of application classes that extend, implement, or have been annotated with the class types specified by the HandlesTypes annotation, or null if there are no matches, or this ServletContainerInitializer has not been annotated with HandlesTypes
c
,
ServletContext
the ServletContext of the web application that is being started and in which the classes contained in c were found
ctx
)

Implements jakarta.servlet.ServletContainerInitializer.onStartup.

Notifies this ServletContainerInitializer of the startup of the application represented by the given ServletContext.

public String
toString()

Overrides org.eclipse.jetty.util.component.AbstractLifeCycle.toString.

Returns a string representation of the object.

Inherited from org.eclipse.jetty.util.component.ContainerLifeCycle:
addBeanaddBeanaddEventListeneraddManagedcontainsdestroydoStartdoStopdumpdumpdumpdumpObjectsdumpStdErrgetBeangetBeansgetBeansgetContainedBeansgetContainedBeansisAutoisManagedisUnmanagedmanageremoveBeanremoveBeansremoveEventListenersetBeansstartstopunmanageupdateBeanupdateBeanupdateBeansupdateBeans

Field Detail

LOGback to summary
private static final Logger LOG

Hides org.eclipse.jetty.util.component.ContainerLifeCycle.LOG.

Constructor Detail

JakartaWebSocketShutdownContainerback to summary
public JakartaWebSocketShutdownContainer()

Method Detail

contextDestroyedback to summary
public void contextDestroyed(ServletContextEvent sce)

Overrides default jakarta.servlet.ServletContextListener.contextDestroyed.

Doc from jakarta.servlet.ServletContextListener.contextDestroyed.

Receives notification that the ServletContext is about to be shut down.

All servlets and filters will have been destroyed before any ServletContextListeners are notified of context destruction.

Parameters
sce:ServletContextEvent

the ServletContextEvent containing the ServletContext that is being destroyed

Annotations
@Override
contextInitializedback to summary
public void contextInitialized(ServletContextEvent sce)

Overrides default jakarta.servlet.ServletContextListener.contextInitialized.

Doc from jakarta.servlet.ServletContextListener.contextInitialized.

Receives notification that the web application initialization process is starting.

All ServletContextListeners are notified of context initialization before any filters or servlets in the web application are initialized.

Parameters
sce:ServletContextEvent

the ServletContextEvent containing the ServletContext that is being initialized

Annotations
@Override
onStartupback to summary
public void onStartup(Set<Class<?>> c, ServletContext ctx) throws ServletException

Implements jakarta.servlet.ServletContainerInitializer.onStartup.

Doc from jakarta.servlet.ServletContainerInitializer.onStartup.

Notifies this ServletContainerInitializer of the startup of the application represented by the given ServletContext.

If this ServletContainerInitializer is bundled in a JAR file inside the WEB-INF/lib directory of an application, its onStartup method will be invoked only once during the startup of the bundling application. If this ServletContainerInitializer is bundled inside a JAR file outside of any WEB-INF/lib directory, but still discoverable as described above, its onStartup method will be invoked every time an application is started.

Parameters
c:Set<Class<?>>

the Set of application classes that extend, implement, or have been annotated with the class types specified by the HandlesTypes annotation, or null if there are no matches, or this ServletContainerInitializer has not been annotated with HandlesTypes

ctx:ServletContext

the ServletContext of the web application that is being started and in which the classes contained in c were found

Annotations
@Override
Exceptions
ServletException:
if an error has occurred
toStringback to summary
public String toString()

Overrides org.eclipse.jetty.util.component.AbstractLifeCycle.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object. Satisfying this method's contract implies a non-null result must be returned.

Returns:String

a string representation of the object

Annotations
@Override