Class WsServerContainer
java.lang.Object
org.apache.tomcat.websocket.WsWebSocketContainer
org.apache.tomcat.websocket.server.WsServerContainer
- All Implemented Interfaces:
- ServerContainer,- WebSocketContainer,- BackgroundProcess
Provides a per class loader (i.e. per web application) instance of a ServerContainer. Web application wide defaults
 may be configured by setting the following servlet context initialisation parameters to the desired values.
 
- 
Method SummaryModifier and TypeMethodDescriptionvoidPublished the provided endpoint implementation at the specified path with the specified configuration.voidaddEndpoint(Class<?> pojo) Provides the equivalent ofaddEndpoint(ServerEndpointConfig)for publishing plain old java objects (POJOs) that have been annotated as WebSocket endpoints.voidcloseAuthenticatedSession(String httpSessionId) org.apache.tomcat.websocket.server.WsMappingResultfindMapping(String path) protected InstanceManagergetInstanceManager(ClassLoader classLoader) Overridden to make it visible to other classes in this package.protected WsWriteTimeoutprotected voidregisterSession(Object key, WsSession wsSession) Overridden to make it visible to other classes in this package.protected voidunregisterSession(Object key, WsSession wsSession) Overridden to make it visible to other classes in this package.voidupgradeHttpToWebSocket(Object httpServletRequest, Object httpServletResponse, ServerEndpointConfig sec, Map<String, String> pathParameters) Upgrade the HTTP connection represented by theHttpServletRequestandHttpServletResponseto the WebSocket protocol and establish a WebSocket connection as per the providedServerEndpointConfig.Methods inherited from class org.apache.tomcat.websocket.WsWebSocketContainerbackgroundProcess, connectToServer, connectToServer, connectToServer, connectToServer, destroy, getDefaultAsyncSendTimeout, getDefaultMaxBinaryMessageBufferSize, getDefaultMaxSessionIdleTimeout, getDefaultMaxTextMessageBufferSize, getInstalledExtensions, getProcessPeriod, setAsyncSendTimeout, setDefaultMaxBinaryMessageBufferSize, setDefaultMaxSessionIdleTimeout, setDefaultMaxTextMessageBufferSize, setInstanceManager, setProcessPeriodMethods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface jakarta.websocket.WebSocketContainerconnectToServer, connectToServer, connectToServer, connectToServer, getDefaultAsyncSendTimeout, getDefaultMaxBinaryMessageBufferSize, getDefaultMaxSessionIdleTimeout, getDefaultMaxTextMessageBufferSize, getInstalledExtensions, setAsyncSendTimeout, setDefaultMaxBinaryMessageBufferSize, setDefaultMaxSessionIdleTimeout, setDefaultMaxTextMessageBufferSize
- 
Method Details- 
addEndpointPublished the provided endpoint implementation at the specified path with the specified configuration.WsServerContainer(ServletContext)must be called before calling this method.- Specified by:
- addEndpointin interface- ServerContainer
- Parameters:
- sec- The configuration to use when creating endpoint instances
- Throws:
- DeploymentException- if the endpoint cannot be published as requested
 
- 
addEndpointProvides the equivalent ofaddEndpoint(ServerEndpointConfig)for publishing plain old java objects (POJOs) that have been annotated as WebSocket endpoints.- Specified by:
- addEndpointin interface- ServerContainer
- Parameters:
- pojo- The annotated POJO
- Throws:
- DeploymentException
 
- 
upgradeHttpToWebSocketpublic void upgradeHttpToWebSocket(Object httpServletRequest, Object httpServletResponse, ServerEndpointConfig sec, Map<String, String> pathParameters) throws IOException, DeploymentExceptionDescription copied from interface:jakarta.websocket.server.ServerContainerUpgrade the HTTP connection represented by theHttpServletRequestandHttpServletResponseto 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.- Specified by:
- upgradeHttpToWebSocketin interface- ServerContainer
- Parameters:
- httpServletRequest- The- HttpServletRequestto be processed as a WebSocket handshake as per section 4.0 of RFC 6455.
- httpServletResponse- The- HttpServletResponseto be used when processing the- httpServletRequestas a WebSocket handshake as per section 4.0 of RFC 6455.
- sec- The server endpoint configuration to use to configure the WebSocket endpoint
- pathParameters- 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:
- 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
 
- 
findMapping
- 
getTimeout
- 
getInstanceManagerOverridden to make it visible to other classes in this package.- Overrides:
- getInstanceManagerin class- WsWebSocketContainer
 
- 
registerSessionOverridden to make it visible to other classes in this package.- Overrides:
- registerSessionin class- WsWebSocketContainer
 
- 
unregisterSessionOverridden to make it visible to other classes in this package.- Overrides:
- unregisterSessionin class- WsWebSocketContainer
 
- 
closeAuthenticatedSession
 
-