Top Fields Constructors Methods
org.eclipse.jetty.ee10.websocket.jakarta.server

public Class JakartaWebSocketServerContainer

extends JakartaWebSocketClientContainer
implements ServerContainer, Listener
Class Inheritance
All Implemented Interfaces
org.eclipse.jetty.util.component.LifeCycle.Listener, java.util.EventListener, jakarta.websocket.server.ServerContainer, jakarta.websocket.WebSocketContainer
Annotations
@ManagedObject:JSR356 Server Container
Imports
java.io.IOException, java.lang.reflect.Modifier, java.util.ArrayList, .List, .Map, java.util.concurrent.Executor, java.util.function.Function, jakarta.servlet.ServletContext, jakarta.servlet.http.HttpServletRequest, .HttpServletResponse, jakarta.websocket.ClientEndpoint, .DeploymentException, jakarta.websocket.server.ServerEndpoint, .ServerEndpointConfig, org.eclipse.jetty.client.HttpClient, org.eclipse.jetty.ee10.servlet.ServletContextHandler, .ServletContextRequest, .ServletContextResponse, org.eclipse.jetty.ee10.websocket.jakarta.client.JakartaWebSocketClientContainer, org.eclipse.jetty.ee10.websocket.jakarta.server.config.ContainerDefaultConfigurator, .JakartaWebSocketServletContainerInitializer, org.eclipse.jetty.ee10.websocket.jakarta.server.internal.AnnotatedServerEndpointConfig, .JakartaWebSocketCreator, org.eclipse.jetty.http.pathmap.PathSpec, .UriTemplatePathSpec, org.eclipse.jetty.server.handler.ContextHandler, org.eclipse.jetty.util.FutureCallback, org.eclipse.jetty.util.annotation.ManagedObject, org.eclipse.jetty.util.component.LifeCycle, org.eclipse.jetty.websocket.core.WebSocketComponents, .WebSocketConstants, org.eclipse.jetty.websocket.core.client.WebSocketCoreClient, org.eclipse.jetty.websocket.core.exception.InvalidSignatureException, org.eclipse.jetty.websocket.core.server.Handshaker, .WebSocketMappings, .WebSocketNegotiator, .WebSocketServerComponents, org.eclipse.jetty.websocket.core.util.ReflectUtils, org.slf4j.Logger, .LoggerFactory

Field Summary

Modifier and TypeField and Description
private List<Class<?>>
private List<ServerEndpointConfig>
private final JakartaWebSocketServerFrameHandlerFactory
public static final String
private static final Logger
public static final String
private final WebSocketMappings
Inherited from org.eclipse.jetty.ee10.websocket.jakarta.client.JakartaWebSocketClientContainer:
coreClientcoreClientFactory

Constructor Summary

AccessConstructor and Description
pack-priv
JakartaWebSocketServerContainer(WebSocketMappings
the WebSocketMappings that this container belongs to
webSocketMappings
,
WebSocketComponents
the WebSocketComponents instance to use
components
,
Function<WebSocketComponents, WebSocketCoreClient>
the supplier of the WebSocketCoreClient instance to use
coreClientSupplier
)

Main entry point for JakartaWebSocketServletContainerInitializer.

Method Summary

Modifier and TypeMethod and Description
public void
addEndpoint(Class<?>
the class of the annotated endpoint
endpointClass
)

Implements jakarta.websocket.server.ServerContainer.addEndpoint.

Deploys the given annotated endpoint into this ServerContainer.

public void
addEndpoint(ServerEndpointConfig
the configuration instance representing the logical endpoint that will be registered.
providedConfig
)

Implements jakarta.websocket.server.ServerContainer.addEndpoint.

Deploys the given endpoint described by the provided configuration into this ServerContainer.

private void
protected void
protected void
protected void
doStart()

Overrides org.eclipse.jetty.ee10.websocket.jakarta.client.JakartaWebSocketClientContainer.doStart.

Starts the managed lifecycle beans in the order they were added.

public static JakartaWebSocketServerContainer
public static JakartaWebSocketServerContainer
getContainer(ServletContext servletContext)

public JakartaWebSocketServerFrameHandlerFactory
public void
upgradeHttpToWebSocket(Object
The HttpServletRequest to be processed as a WebSocket handshake as per section 4.0 of RFC 6455.
httpServletRequest
,
Object
The HttpServletResponse to be used when processing the httpServletRequest as a WebSocket handshake as per section 4.0 of RFC 6455.
httpServletResponse
,
ServerEndpointConfig
The server endpoint configuration to use to configure the WebSocket endpoint
sec
,
Map<String, String>
Provides a mapping of path parameter names and values, if any, to be used for the WebSocket connection established by the call to this method. If no such mapping is defined, an empty Map must be passed.
pathParameters
)

Implements jakarta.websocket.server.ServerContainer.upgradeHttpToWebSocket.

Upgrade the HTTP connection represented by the HttpServletRequest and HttpServletResponse to the WebSocket protocol and establish a WebSocket connection as per the provided ServerEndpointConfig.

private void
Inherited from org.eclipse.jetty.ee10.websocket.jakarta.client.JakartaWebSocketClientContainer:
connectToServerconnectToServerconnectToServerconnectToServerconvertCausedoStopgetContextHandlergetExecutorgetHttpClientgetWebSocketCoreClientsetShutdownContainer

Field Detail

deferredEndpointClassesback to summary
private List<Class<?>> deferredEndpointClasses
deferredEndpointConfigsback to summary
private List<ServerEndpointConfig> deferredEndpointConfigs
frameHandlerFactoryback to summary
private final JakartaWebSocketServerFrameHandlerFactory frameHandlerFactory

Hides org.eclipse.jetty.ee10.websocket.jakarta.client.JakartaWebSocketClientContainer.frameHandlerFactory.

JAKARTA_WEBSOCKET_CONTAINER_ATTRIBUTEback to summary
public static final String JAKARTA_WEBSOCKET_CONTAINER_ATTRIBUTE
LOGback to summary
private static final Logger LOG

Hides org.eclipse.jetty.ee10.websocket.jakarta.client.JakartaWebSocketClientContainer.LOG.

PATH_PARAM_ATTRIBUTEback to summary
public static final String PATH_PARAM_ATTRIBUTE
webSocketMappingsback to summary
private final WebSocketMappings webSocketMappings

Constructor Detail

JakartaWebSocketServerContainerback to summary
pack-priv JakartaWebSocketServerContainer(WebSocketMappings webSocketMappings, WebSocketComponents components, Function<WebSocketComponents, WebSocketCoreClient> coreClientSupplier)

Main entry point for JakartaWebSocketServletContainerInitializer.

Parameters
webSocketMappings:WebSocketMappings

the WebSocketMappings that this container belongs to

components:WebSocketComponents

the WebSocketComponents instance to use

coreClientSupplier:Function<WebSocketComponents, WebSocketCoreClient>

the supplier of the WebSocketCoreClient instance to use

Method Detail

addEndpointback to summary
public void addEndpoint(Class<?> endpointClass) throws DeploymentException

Implements jakarta.websocket.server.ServerContainer.addEndpoint.

Doc from jakarta.websocket.server.ServerContainer.addEndpoint.

Deploys the given annotated endpoint into this ServerContainer.

Parameters
endpointClass:Class<?>

the class of the annotated endpoint

Annotations
@Override
Exceptions
DeploymentException:
if the annotated endpoint was badly formed.
addEndpointback to summary
public void addEndpoint(ServerEndpointConfig providedConfig) throws DeploymentException

Implements jakarta.websocket.server.ServerContainer.addEndpoint.

Doc from jakarta.websocket.server.ServerContainer.addEndpoint.

Deploys the given endpoint described by the provided configuration into this ServerContainer.

Parameters
providedConfig:ServerEndpointConfig

the configuration instance representing the logical endpoint that will be registered.

Annotations
@Override
Exceptions
DeploymentException:
if the endpoint was badly formed.
addEndpointMappingback to summary
private void addEndpointMapping(ServerEndpointConfig config) throws DeploymentException
doClientStartback to summary
protected void doClientStart()

Overrides org.eclipse.jetty.ee10.websocket.jakarta.client.JakartaWebSocketClientContainer.doClientStart.

Annotations
@Override
doClientStopback to summary
protected void doClientStop()

Overrides org.eclipse.jetty.ee10.websocket.jakarta.client.JakartaWebSocketClientContainer.doClientStop.

Annotations
@Override
doStartback to summary
protected void doStart() throws Exception

Overrides org.eclipse.jetty.ee10.websocket.jakarta.client.JakartaWebSocketClientContainer.doStart.

Doc from org.eclipse.jetty.util.component.ContainerLifeCycle.doStart.

Starts the managed lifecycle beans in the order they were added.

Annotations
@Override
Exceptions
Exception:

Doc from org.eclipse.jetty.util.component.AbstractLifeCycle.doStart.

If there was a problem starting. Will cause a transition to FAILED state

ensureContainerback to summary
public static JakartaWebSocketServerContainer ensureContainer(ServletContext servletContext)
getContainerback to summary
public static JakartaWebSocketServerContainer getContainer(ServletContext servletContext)
getFrameHandlerFactoryback to summary
public JakartaWebSocketServerFrameHandlerFactory getFrameHandlerFactory()

Overrides org.eclipse.jetty.ee10.websocket.jakarta.client.JakartaWebSocketClientContainer.getFrameHandlerFactory.

Annotations
@Override
upgradeHttpToWebSocketback to summary
public void upgradeHttpToWebSocket(Object httpServletRequest, Object httpServletResponse, ServerEndpointConfig sec, Map<String, String> pathParameters) throws IOException, DeploymentException

Implements jakarta.websocket.server.ServerContainer.upgradeHttpToWebSocket.

Doc from jakarta.websocket.server.ServerContainer.upgradeHttpToWebSocket.

Upgrade the HTTP connection represented by the HttpServletRequest and HttpServletResponse to the WebSocket protocol and establish a WebSocket connection as per the provided ServerEndpointConfig.

This method is primarily intended to be used by frameworks that implement the front-controller pattern. It does not deploy the provided endpoint.

If the WebSocket implementation is not deployed as part of a Jakarta Servlet container, this method will throw an UnsupportedOperationException.

Parameters
httpServletRequest:Object

The HttpServletRequest to be processed as a WebSocket handshake as per section 4.0 of RFC 6455.

httpServletResponse:Object

The HttpServletResponse to be used when processing the httpServletRequest as a WebSocket handshake as per section 4.0 of RFC 6455.

sec:ServerEndpointConfig

The server endpoint configuration to use to configure the WebSocket endpoint

pathParameters:Map<String, String>

Provides a mapping of path parameter names and values, if any, to be used for the WebSocket connection established by the call to this method. If no such mapping is defined, an empty Map must be passed.

Annotations
@Override
Exceptions
IOException:
if an I/O error occurs during the establishment of a WebSocket connection
DeploymentException:
if a configuration error prevents the establishment of a WebSocket connection
validateEndpointConfigback to summary
private void validateEndpointConfig(ServerEndpointConfig config) throws DeploymentException