Class WebSocketServerContainerInitializer

  • All Implemented Interfaces:
    javax.servlet.ServletContainerInitializer

    public class WebSocketServerContainerInitializer
    extends java.lang.Object
    implements javax.servlet.ServletContainerInitializer
    • 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
      • 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
    • Constructor Detail

      • WebSocketServerContainerInitializer

        public WebSocketServerContainerInitializer()
    • Method Detail

      • isEnabledViaContext

        public static boolean isEnabledViaContext​(javax.servlet.ServletContext context,
                                                  java.lang.String keyName,
                                                  boolean defValue)
        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 - the context to search
        keyName - the key name
        defValue - the default value, if the value is not specified in the context
        Returns:
        the value for the feature key
      • initialize

        public static ServerContainer initialize​(ServletContextHandler context)
                                          throws javax.servlet.ServletException
        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.

        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
      • onStartup

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