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.WebSocketContainer
private static Object
private static final org.eclipse.jetty.util.log.Logger
private static boolean
private static boolean
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected javax.websocket.WebSocketContainer
Used byContainerProvider.getWebSocketContainer()
to get a new instance of the ClientWebSocketContainer
.static void
useServerContainer
(boolean flag) Add ability of calls toContainerProvider.getWebSocketContainer()
to find and return thejavax.websocket.server.ServerContainer
from the activejavax.servlet.ServletContext
.static void
useSingleton
(boolean flag) Change calls toContainerProvider.getWebSocketContainer()
to always return a singleton instance of the sameWebSocketContainer
static boolean
Test ifContainerProvider.getWebSocketContainer()
has the ability to find and return thejavax.websocket.server.ServerContainer
from the activejavax.servlet.ServletContext
, before creating a new client basedWebSocketContainer
.static boolean
Test ifContainerProvider.getWebSocketContainer()
will always return a singleton instance of the sameWebSocketContainer
Methods 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 ofWebSocketContainer
for 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
WebSocketContainer
for all calls toContainerProvider.getWebSocketContainer()
-
useServerContainer
public static void useServerContainer(boolean flag) Add ability of calls toContainerProvider.getWebSocketContainer()
to find and return thejavax.websocket.server.ServerContainer
from 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.ServerContainer
from the activejavax.servlet.ServletContext
for 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.ServerContainer
from the activejavax.servlet.ServletContext
, before creating a new client basedWebSocketContainer
.- Returns:
- true if
WebSocketContainer
returned from calls toContainerProvider.getWebSocketContainer()
could be thejavax.websocket.server.ServerContainer
from the activejavax.servlet.ServletContext
-
getContextHandler
-
getContainer
protected javax.websocket.WebSocketContainer getContainer()Used byContainerProvider.getWebSocketContainer()
to get a new instance of the ClientWebSocketContainer
.- Specified by:
getContainer
in classjavax.websocket.ContainerProvider
-