Class JettyClientContainerProvider

java.lang.Object
javax.websocket.ContainerProvider
org.eclipse.jetty.websocket.jsr356.JettyClientContainerProvider

public class JettyClientContainerProvider extends javax.websocket.ContainerProvider
Client ContainerProvider implementation.

Created by a ServiceLoader call in the ContainerProvider.getWebSocketContainer() call.

  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private static javax.websocket.WebSocketContainer
     
    private static Object
     
    private static final org.eclipse.jetty.util.log.Logger
     
    private static boolean
     
    private static boolean
     
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected javax.websocket.WebSocketContainer
    Used by ContainerProvider.getWebSocketContainer() to get a new instance of the Client WebSocketContainer.
     
    static void
    useServerContainer(boolean flag)
    Add ability of calls to ContainerProvider.getWebSocketContainer() to find and return the javax.websocket.server.ServerContainer from the active javax.servlet.ServletContext.
    static void
    useSingleton(boolean flag)
    Change calls to ContainerProvider.getWebSocketContainer() to always return a singleton instance of the same WebSocketContainer
    static boolean
    Test if ContainerProvider.getWebSocketContainer() has the ability to find and return the javax.websocket.server.ServerContainer from the active javax.servlet.ServletContext, before creating a new client based WebSocketContainer.
    static boolean
    Test if ContainerProvider.getWebSocketContainer() will always return a singleton instance of the same WebSocketContainer

    Methods inherited from class javax.websocket.ContainerProvider

    getWebSocketContainer

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • LOG

      private static final org.eclipse.jetty.util.log.Logger LOG
    • useSingleton

      private static boolean useSingleton
    • useServerContainer

      private static boolean useServerContainer
    • INSTANCE

      private static javax.websocket.WebSocketContainer INSTANCE
    • lock

      private static Object lock
  • Constructor Details

    • JettyClientContainerProvider

      public JettyClientContainerProvider()
  • Method Details

    • useSingleton

      public static void useSingleton(boolean flag)
      Change calls to ContainerProvider.getWebSocketContainer() to always return a singleton instance of the same WebSocketContainer
      Parameters:
      flag - true to use a singleton instance of WebSocketContainer for all calls to ContainerProvider.getWebSocketContainer()
    • willUseSingleton

      public static boolean willUseSingleton()
      Test if ContainerProvider.getWebSocketContainer() will always return a singleton instance of the same WebSocketContainer
      Returns:
      true if using a singleton instance of WebSocketContainer for all calls to ContainerProvider.getWebSocketContainer()
    • useServerContainer

      public static void useServerContainer(boolean flag)
      Add ability of calls to ContainerProvider.getWebSocketContainer() to find and return the javax.websocket.server.ServerContainer from the active javax.servlet.ServletContext.

      This will only work if the call to ContainerProvider.getWebSocketContainer() occurs within a thread being processed by the Servlet container.

      Parameters:
      flag - true to to use return the javax.websocket.server.ServerContainer from the active javax.servlet.ServletContext for all calls to ContainerProvider.getWebSocketContainer() from within a Servlet thread.
    • willUseServerContainer

      public static boolean willUseServerContainer()
      Test if ContainerProvider.getWebSocketContainer() has the ability to find and return the javax.websocket.server.ServerContainer from the active javax.servlet.ServletContext, before creating a new client based WebSocketContainer.
      Returns:
      true if WebSocketContainer returned from calls to ContainerProvider.getWebSocketContainer() could be the javax.websocket.server.ServerContainer from the active javax.servlet.ServletContext
    • getContextHandler

      public Object getContextHandler()
    • getContainer

      protected javax.websocket.WebSocketContainer getContainer()
      Used by ContainerProvider.getWebSocketContainer() to get a new instance of the Client WebSocketContainer.
      Specified by:
      getContainer in class javax.websocket.ContainerProvider