Top Inners Fields Constructors Methods
org.eclipse.jetty.ee10.websocket.jakarta.server.config

public Class JakartaWebSocketServletContainerInitializer

extends Object
implements ServletContainerInitializer
Class Inheritance
All Implemented Interfaces
jakarta.servlet.ServletContainerInitializer
Annotations
@HandlesTypes:ServerApplicationConfig, ServerEndpoint, Endpoint
Imports
java.util.HashSet, .Set, jakarta.servlet.ServletContainerInitializer, .ServletContext, .ServletException, jakarta.servlet.annotation.HandlesTypes, jakarta.websocket.DeploymentException, .Endpoint, jakarta.websocket.server.ServerApplicationConfig, .ServerContainer, .ServerEndpoint, .ServerEndpointConfig, org.eclipse.jetty.ee10.servlet.FilterHolder, .ServletContextHandler, org.eclipse.jetty.ee10.websocket.jakarta.server.JakartaWebSocketServerContainer, org.eclipse.jetty.ee10.websocket.servlet.WebSocketUpgradeFilter, org.eclipse.jetty.util.TypeUtil, org.eclipse.jetty.util.thread.ThreadClassLoaderScope, org.eclipse.jetty.websocket.core.WebSocketComponents, org.eclipse.jetty.websocket.core.server.WebSocketMappings, .WebSocketServerComponents, org.slf4j.Logger, .LoggerFactory

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static interface

Field Summary

Modifier and TypeField and Description
public static final String
ATTR_JAKARTA_SERVER_CONTAINER

The ServletContext attribute key name for the ServerContainer per jakarta.websocket spec 1.0 final section 6.4 Programmatic Server Deployment

private final JakartaWebSocketServletContainerInitializer.Configurator
public static final String
public static final String
private static final Logger

Constructor Summary

AccessConstructor and Description
public
public

Method Summary

Modifier and TypeMethod and Description
public static void
configure(ServletContextHandler
the context to add listener to
context
,
JakartaWebSocketServletContainerInitializer.Configurator
the lambda that is called to allow the ServerContainer to be configured during the ServletContext initialization phase
configurator
)

Configure the ServletContextHandler to call JakartaWebSocketServletContainerInitializer#onStartup(Set, ServletContext) during the ServletContext initialization phase.

private void
filterClasses(Set<Class<?>> c, Set<Class<? extends Endpoint>> discoveredExtendedEndpoints, Set<Class<?>> discoveredAnnotatedEndpoints, Set<Class<? extends ServerApplicationConfig>> serverAppConfigs)

public static ServerContainer

Returns:

the default ServerContainer for this context
initialize
(ServletContextHandler
the context to work with
context
)

Immediately initialize the ServletContext with the default (and empty) ServerContainer.

private static Boolean

Returns:

the value for the feature key, otherwise null if key is not set in context
isEnabledViaContext
(ServletContext
the context to search
context
,
String
the key name
keyName
)

Test a ServletContext for init-param or attribute at keyName for true or false setting that determines if the specified feature is enabled (or not).

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
context
)

Implements jakarta.servlet.ServletContainerInitializer.onStartup.

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

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

ATTR_JAKARTA_SERVER_CONTAINERback to summary
public static final String ATTR_JAKARTA_SERVER_CONTAINER

The ServletContext attribute key name for the ServerContainer per jakarta.websocket spec 1.0 final section 6.4 Programmatic Server Deployment

configuratorback to summary
private final JakartaWebSocketServletContainerInitializer.Configurator configurator
ENABLE_KEYback to summary
public static final String ENABLE_KEY
HTTPCLIENT_ATTRIBUTEback to summary
public static final String HTTPCLIENT_ATTRIBUTE
LOGback to summary
private static final Logger LOG

Constructor Detail

JakartaWebSocketServletContainerInitializerback to summary
public JakartaWebSocketServletContainerInitializer()
JakartaWebSocketServletContainerInitializerback to summary
public JakartaWebSocketServletContainerInitializer(JakartaWebSocketServletContainerInitializer.Configurator configurator)

Method Detail

configureback to summary
public static void configure(ServletContextHandler context, JakartaWebSocketServletContainerInitializer.Configurator configurator)

Configure the ServletContextHandler to call JakartaWebSocketServletContainerInitializer#onStartup(Set, ServletContext) during the ServletContext initialization phase.

Parameters
context:ServletContextHandler

the context to add listener to

configurator:JakartaWebSocketServletContainerInitializer.Configurator

the lambda that is called to allow the ServerContainer to be configured during the ServletContext initialization phase

filterClassesback to summary
private void filterClasses(Set<Class<?>> c, Set<Class<? extends Endpoint>> discoveredExtendedEndpoints, Set<Class<?>> discoveredAnnotatedEndpoints, Set<Class<? extends ServerApplicationConfig>> serverAppConfigs)
Annotations
@SuppressWarnings:unchecked
initializeback to summary
public static ServerContainer initialize(ServletContextHandler context)

Immediately initialize the ServletContext with the default (and empty) ServerContainer.

This method is typically called from onStartup(Set, ServletContext) itself or from another dependent ServletContainerInitializer that requires minimal setup to be performed.

Users of Jetty should use the configure(ServletContextHandler, Configurator) method instead.

There is no enablement check here, and no automatic deployment of endpoints at this point in time. It merely sets up the ServletContext so with the basics needed to start configuring for `jakarta.websocket.server` based endpoints.

Parameters
context:ServletContextHandler

the context to work with

Returns:ServerContainer

the default ServerContainer for this context

isEnabledViaContextback to summary
private static Boolean isEnabledViaContext(ServletContext context, String keyName)

Test a ServletContext for init-param or attribute at keyName for true or false setting that determines if the specified feature is enabled (or not).

Parameters
context:ServletContext

the context to search

keyName:String

the key name

Returns:Boolean

the value for the feature key, otherwise null if key is not set in context

onStartupback to summary
public void onStartup(Set<Class<?>> c, ServletContext context) 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

context: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
org.eclipse.jetty.ee10.websocket.jakarta.server.config back to summary

public Interface JakartaWebSocketServletContainerInitializer.Configurator


Method Summary

Modifier and TypeMethod and Description
public void
accept(ServletContext servletContext, ServerContainer serverContainer)

Method Detail

acceptback to summary
public void accept(ServletContext servletContext, ServerContainer serverContainer) throws DeploymentException