Class WebSocketServerContainerInitializer
- java.lang.Object
-
- org.eclipse.jetty.websocket.jsr356.server.deploy.WebSocketServerContainerInitializer
-
- All Implemented Interfaces:
javax.servlet.ServletContainerInitializer
public class WebSocketServerContainerInitializer extends java.lang.Object implements javax.servlet.ServletContainerInitializer
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfaceWebSocketServerContainerInitializer.Configuratorstatic classWebSocketServerContainerInitializer.ContextDestroyListenerDestroyListener
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringADD_DYNAMIC_FILTER_KEYstatic java.lang.StringATTR_JAVAX_SERVER_CONTAINERThe ServletContext attribute key name for the ServerContainer per javax.websocket spec 1.0 final section 6.4 Programmatic Server Deploymentstatic java.lang.StringENABLE_KEYstatic java.lang.StringHTTPCLIENT_ATTRIBUTE
-
Constructor Summary
Constructors Constructor Description WebSocketServerContainerInitializer()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static voidconfigure(ServletContextHandler context, WebSocketServerContainerInitializer.Configurator configurator)Configure theServletContextHandlerto callonStartup(Set, ServletContext)during theServletContextinitialization phase.static ServerContainerconfigureContext(javax.servlet.ServletContext context, ServletContextHandler jettyContext)Deprecated.useconfigure(ServletContextHandler, Configurator)insteadstatic ServerContainerconfigureContext(ServletContextHandler context)Deprecated.useconfigure(ServletContextHandler, Configurator)insteadstatic ServerContainerinitialize(ServletContextHandler context)Immediately initialize theServletContextwith the default (and empty)ServerContainer.static booleanisEnabledViaContext(javax.servlet.ServletContext context, java.lang.String keyName, boolean defValue)Test a ServletContext forinit-paramorattributeatkeyNamefor true or false setting that determines if the specified feature is enabled (or not).voidonStartup(java.util.Set<java.lang.Class<?>> c, javax.servlet.ServletContext context)
-
-
-
Field Detail
-
ATTR_JAVAX_SERVER_CONTAINER
public static final java.lang.String 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
public static final java.lang.String ENABLE_KEY
- See Also:
- Constant Field Values
-
ADD_DYNAMIC_FILTER_KEY
public static final java.lang.String ADD_DYNAMIC_FILTER_KEY
- See Also:
- Constant Field Values
-
HTTPCLIENT_ATTRIBUTE
public static final java.lang.String HTTPCLIENT_ATTRIBUTE
- See Also:
- Constant Field Values
-
-
Method Detail
-
isEnabledViaContext
public static boolean isEnabledViaContext(javax.servlet.ServletContext context, java.lang.String keyName, boolean defValue)Test a ServletContext forinit-paramorattributeatkeyNamefor 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(ServletContextHandler context) throws javax.servlet.ServletException
Deprecated.useconfigure(ServletContextHandler, Configurator)instead- Parameters:
context- theServletContextHandlerto use- Returns:
- a configured
ServerContainerinstance - Throws:
javax.servlet.ServletException- if theWebSocketUpgradeFiltercannot be configured
-
configureContext
@Deprecated public static ServerContainer configureContext(javax.servlet.ServletContext context, ServletContextHandler jettyContext) throws javax.servlet.ServletException
Deprecated.useconfigure(ServletContextHandler, Configurator)instead- Parameters:
context- not usedjettyContext- theServletContextHandlerto use- Returns:
- a configured
ServerContainerinstance - Throws:
javax.servlet.ServletException- if theWebSocketUpgradeFiltercannot be configured
-
initialize
public static ServerContainer initialize(ServletContextHandler context) throws javax.servlet.ServletException
Immediately initialize theServletContextwith the default (and empty)ServerContainer.This method is typically called from
onStartup(Set, ServletContext)itself or from another dependentServletContainerInitializerthat 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
ServletContextso with the basics needed to start configuring for `javax.websocket.server` based endpoints.- Parameters:
context- the context to work with- Returns:
- the default
ServerContainerfor this context - Throws:
javax.servlet.ServletException
-
configure
public static void configure(ServletContextHandler context, WebSocketServerContainerInitializer.Configurator configurator)
Configure theServletContextHandlerto callonStartup(Set, ServletContext)during theServletContextinitialization phase.- Parameters:
context- the context to add listener toconfigurator- the lambda that is called to allow theServerContainerto be configured during theServletContextinitialization phase
-
onStartup
public void onStartup(java.util.Set<java.lang.Class<?>> c, javax.servlet.ServletContext context) throws javax.servlet.ServletException- Specified by:
onStartupin interfacejavax.servlet.ServletContainerInitializer- Throws:
javax.servlet.ServletException
-
-