Package jakarta.websocket.server
Interface ServerContainer
-
- All Superinterfaces:
WebSocketContainer
public interface ServerContainer extends WebSocketContainer
Provides the ability to deploy endpoints programmatically.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
addEndpoint(ServerEndpointConfig sec)
void
addEndpoint(java.lang.Class<?> clazz)
void
upgradeHttpToWebSocket(java.lang.Object httpServletRequest, java.lang.Object httpServletResponse, ServerEndpointConfig sec, java.util.Map<java.lang.String,java.lang.String> pathParameters)
Upgrade the HTTP connection represented by theHttpServletRequest
andHttpServletResponse
to the WebSocket protocol and establish a WebSocket connection as per the providedServerEndpointConfig
.-
Methods inherited from interface jakarta.websocket.WebSocketContainer
connectToServer, connectToServer, connectToServer, connectToServer, getDefaultAsyncSendTimeout, getDefaultMaxBinaryMessageBufferSize, getDefaultMaxSessionIdleTimeout, getDefaultMaxTextMessageBufferSize, getInstalledExtensions, setAsyncSendTimeout, setDefaultMaxBinaryMessageBufferSize, setDefaultMaxSessionIdleTimeout, setDefaultMaxTextMessageBufferSize
-
-
-
-
Method Detail
-
addEndpoint
void addEndpoint(java.lang.Class<?> clazz) throws DeploymentException
- Throws:
DeploymentException
-
addEndpoint
void addEndpoint(ServerEndpointConfig sec) throws DeploymentException
- Throws:
DeploymentException
-
upgradeHttpToWebSocket
void upgradeHttpToWebSocket(java.lang.Object httpServletRequest, java.lang.Object httpServletResponse, ServerEndpointConfig sec, java.util.Map<java.lang.String,java.lang.String> pathParameters) throws java.io.IOException, DeploymentException
Upgrade the HTTP connection represented by theHttpServletRequest
andHttpServletResponse
to the WebSocket protocol and establish a WebSocket connection as per the providedServerEndpointConfig
.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
- TheHttpServletRequest
to be processed as a WebSocket handshake as per section 4.0 of RFC 6455.httpServletResponse
- TheHttpServletResponse
to be used when processing thehttpServletRequest
as a WebSocket handshake as per section 4.0 of RFC 6455.sec
- The server endpoint configuration to use to configure the WebSocket endpointpathParameters
- 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.- Throws:
java.lang.IllegalStateException
- if the provided request does not meet the requirements of the WebSocket handshakejava.lang.UnsupportedOperationException
- if the WebSocket implementation is not deployed as part of a Jakarta Servlet containerjava.io.IOException
- if an I/O error occurs during the establishment of a WebSocket connectionDeploymentException
- if a configuration error prevents the establishment of a WebSocket connection- Since:
- WebSocket 2.0
-
-