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
FieldsModifier and TypeFieldDescriptionprivate static javax.websocket.WebSocketContainerprivate static Objectprivate static final org.eclipse.jetty.util.log.Loggerprivate static booleanprivate static boolean -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected javax.websocket.WebSocketContainerUsed byContainerProvider.getWebSocketContainer()to get a new instance of the ClientWebSocketContainer.static voiduseServerContainer(boolean flag) Add ability of calls toContainerProvider.getWebSocketContainer()to find and return thejavax.websocket.server.ServerContainerfrom the activejavax.servlet.ServletContext.static voiduseSingleton(boolean flag) Change calls toContainerProvider.getWebSocketContainer()to always return a singleton instance of the sameWebSocketContainerstatic booleanTest ifContainerProvider.getWebSocketContainer()has the ability to find and return thejavax.websocket.server.ServerContainerfrom the activejavax.servlet.ServletContext, before creating a new client basedWebSocketContainer.static booleanTest ifContainerProvider.getWebSocketContainer()will always return a singleton instance of the sameWebSocketContainerMethods inherited from class javax.websocket.ContainerProvider
getWebSocketContainer
-
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
-
-
Constructor Details
-
JettyClientContainerProvider
public JettyClientContainerProvider()
-
-
Method Details
-
useSingleton
public static void useSingleton(boolean flag) Change calls toContainerProvider.getWebSocketContainer()to always return a singleton instance of the sameWebSocketContainer- Parameters:
flag- true to use a singleton instance ofWebSocketContainerfor all calls toContainerProvider.getWebSocketContainer()
-
willUseSingleton
public static boolean willUseSingleton()Test ifContainerProvider.getWebSocketContainer()will always return a singleton instance of the sameWebSocketContainer- Returns:
- true if using a singleton instance of
WebSocketContainerfor all calls toContainerProvider.getWebSocketContainer()
-
useServerContainer
public static void useServerContainer(boolean flag) Add ability of calls toContainerProvider.getWebSocketContainer()to find and return thejavax.websocket.server.ServerContainerfrom the activejavax.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 thejavax.websocket.server.ServerContainerfrom the activejavax.servlet.ServletContextfor all calls toContainerProvider.getWebSocketContainer()from within a Servlet thread.
-
willUseServerContainer
public static boolean willUseServerContainer()Test ifContainerProvider.getWebSocketContainer()has the ability to find and return thejavax.websocket.server.ServerContainerfrom the activejavax.servlet.ServletContext, before creating a new client basedWebSocketContainer.- Returns:
- true if
WebSocketContainerreturned from calls toContainerProvider.getWebSocketContainer()could be thejavax.websocket.server.ServerContainerfrom the activejavax.servlet.ServletContext
-
getContextHandler
-
getContainer
protected javax.websocket.WebSocketContainer getContainer()Used byContainerProvider.getWebSocketContainer()to get a new instance of the ClientWebSocketContainer.- Specified by:
getContainerin classjavax.websocket.ContainerProvider
-