Class WebSocketServerContainerInitializer
java.lang.Object
org.eclipse.jetty.websocket.jsr356.server.deploy.WebSocketServerContainerInitializer
- All Implemented Interfaces:
javax.servlet.ServletContainerInitializer
public class WebSocketServerContainerInitializer
extends Object
implements javax.servlet.ServletContainerInitializer
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interface
static class
DestroyListener -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final String
static final String
The ServletContext attribute key name for the ServerContainer per javax.websocket spec 1.0 final section 6.4 Programmatic Server Deploymentstatic final String
static final String
private static final org.eclipse.jetty.util.log.Logger
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic void
configure
(org.eclipse.jetty.servlet.ServletContextHandler context, WebSocketServerContainerInitializer.Configurator configurator) Configure theServletContextHandler
to callonStartup(Set, ServletContext)
during theServletContext
initialization phase.static ServerContainer
configureContext
(javax.servlet.ServletContext context, org.eclipse.jetty.servlet.ServletContextHandler jettyContext) Deprecated.static ServerContainer
configureContext
(org.eclipse.jetty.servlet.ServletContextHandler context) Deprecated.useconfigure(ServletContextHandler, Configurator)
insteadprivate void
filterClasses
(Set<Class<?>> c, Set<Class<? extends javax.websocket.Endpoint>> discoveredExtendedEndpoints, Set<Class<?>> discoveredAnnotatedEndpoints, Set<Class<? extends javax.websocket.server.ServerApplicationConfig>> serverAppConfigs) static ServerContainer
initialize
(org.eclipse.jetty.servlet.ServletContextHandler context) Immediately initialize theServletContext
with the default (and empty)ServerContainer
.static boolean
isEnabledViaContext
(javax.servlet.ServletContext context, String keyName, boolean defValue) Test a ServletContext forinit-param
orattribute
atkeyName
for true or false setting that determines if the specified feature is enabled (or not).void
-
Field Details
-
ATTR_JAVAX_SERVER_CONTAINER
The ServletContext attribute key name for the ServerContainer per javax.websocket spec 1.0 final section 6.4 Programmatic Server Deployment -
ENABLE_KEY
- See Also:
-
ADD_DYNAMIC_FILTER_KEY
- See Also:
-
LOG
private static final org.eclipse.jetty.util.log.Logger LOG -
HTTPCLIENT_ATTRIBUTE
- See Also:
-
-
Constructor Details
-
WebSocketServerContainerInitializer
public WebSocketServerContainerInitializer()
-
-
Method Details
-
isEnabledViaContext
public static boolean isEnabledViaContext(javax.servlet.ServletContext context, String keyName, boolean defValue) Test a ServletContext forinit-param
orattribute
atkeyName
for true or false setting that determines if the specified feature is enabled (or not).- Parameters:
context
- the context to searchkeyName
- the key namedefValue
- the default value, if the value is not specified in the context- Returns:
- the value for the feature key
-
configureContext
@Deprecated public static ServerContainer configureContext(org.eclipse.jetty.servlet.ServletContextHandler context) throws javax.servlet.ServletException Deprecated.useconfigure(ServletContextHandler, Configurator)
instead- Parameters:
context
- theServletContextHandler
to use- Returns:
- a configured
ServerContainer
instance - Throws:
javax.servlet.ServletException
- if theWebSocketUpgradeFilter
cannot be configured
-
configureContext
@Deprecated public static ServerContainer configureContext(javax.servlet.ServletContext context, org.eclipse.jetty.servlet.ServletContextHandler jettyContext) throws javax.servlet.ServletException Deprecated.useconfigure(ServletContextHandler, Configurator)
instead- Parameters:
context
- not usedjettyContext
- theServletContextHandler
to use- Returns:
- a configured
ServerContainer
instance - Throws:
javax.servlet.ServletException
- if theWebSocketUpgradeFilter
cannot be configured
-
initialize
public static ServerContainer initialize(org.eclipse.jetty.servlet.ServletContextHandler context) throws javax.servlet.ServletException Immediately initialize theServletContext
with the default (and empty)ServerContainer
.This method is typically called from
onStartup(Set, ServletContext)
itself or from another dependentServletContainerInitializer
that requires minimal setup to be performed.This method SHOULD NOT BE CALLED by users of Jetty. 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 `javax.websocket.server` based endpoints.- Parameters:
context
- the context to work with- Returns:
- the default
ServerContainer
for this context - Throws:
javax.servlet.ServletException
-
configure
public static void configure(org.eclipse.jetty.servlet.ServletContextHandler context, WebSocketServerContainerInitializer.Configurator configurator) Configure theServletContextHandler
to callonStartup(Set, ServletContext)
during theServletContext
initialization phase.- Parameters:
context
- the context to add listener toconfigurator
- the lambda that is called to allow theServerContainer
to be configured during theServletContext
initialization phase
-
onStartup
public void onStartup(Set<Class<?>> c, javax.servlet.ServletContext context) throws javax.servlet.ServletException - Specified by:
onStartup
in interfacejavax.servlet.ServletContainerInitializer
- Throws:
javax.servlet.ServletException
-
filterClasses
-
configure(ServletContextHandler, Configurator)
instead