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 Summary
Modifier and TypeMethodDescriptionvoidaddEndpoint(Class<?> pojo) Provides the equivalent ofaddEndpoint(ServerEndpointConfig)for publishing plain old java objects (POJOs) that have been annotated as WebSocket endpoints.voidPublished the provided endpoint implementation at the specified path with the specified configuration.voidcloseAuthenticatedSession(String httpSessionId) voiddoUpgrade(HttpServletRequest request, HttpServletResponse response, ServerEndpointConfig sec, Map<String, String> pathParams) Until the WebSocket specification provides such a mechanism, this Tomcat proprietary method is provided to enable applications to programmatically determine whether or not to upgrade an individual request to WebSocket.org.apache.tomcat.websocket.server.WsMappingResultfindMapping(String path) protected WsWriteTimeoutbooleanprotected voidregisterSession(Object key, WsSession wsSession) Overridden to make it visible to other classes in this package.voidsetEnforceNoAddAfterHandshake(boolean enforceNoAddAfterHandshake) protected voidunregisterSession(Object key, WsSession wsSession) Overridden to make it visible to other classes in this package.Methods inherited from class org.apache.tomcat.websocket.WsWebSocketContainer
backgroundProcess, connectToServer, connectToServer, connectToServer, connectToServer, destroy, getDefaultAsyncSendTimeout, getDefaultMaxBinaryMessageBufferSize, getDefaultMaxSessionIdleTimeout, getDefaultMaxTextMessageBufferSize, getInstalledExtensions, getProcessPeriod, setAsyncSendTimeout, setDefaultMaxBinaryMessageBufferSize, setDefaultMaxSessionIdleTimeout, setDefaultMaxTextMessageBufferSize, setInstanceManager, setProcessPeriodMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface javax.websocket.WebSocketContainer
connectToServer, connectToServer, connectToServer, connectToServer, getDefaultAsyncSendTimeout, getDefaultMaxBinaryMessageBufferSize, getDefaultMaxSessionIdleTimeout, getDefaultMaxTextMessageBufferSize, getInstalledExtensions, setAsyncSendTimeout, setDefaultMaxBinaryMessageBufferSize, setDefaultMaxSessionIdleTimeout, setDefaultMaxTextMessageBufferSize
-
Method Details
-
addEndpoint
Published the provided endpoint implementation at the specified path with the specified configuration.WsServerContainer(ServletContext)must be called before calling this method.- Specified by:
addEndpointin interfaceServerContainer- Parameters:
sec- The configuration to use when creating endpoint instances- Throws:
DeploymentException- if the endpoint cannot be published as requested
-
addEndpoint
Provides the equivalent ofaddEndpoint(ServerEndpointConfig)for publishing plain old java objects (POJOs) that have been annotated as WebSocket endpoints.- Specified by:
addEndpointin interfaceServerContainer- Parameters:
pojo- The annotated POJO- Throws:
DeploymentException
-
doUpgrade
public void doUpgrade(HttpServletRequest request, HttpServletResponse response, ServerEndpointConfig sec, Map<String, String> pathParams) throws ServletException, IOExceptionUntil the WebSocket specification provides such a mechanism, this Tomcat proprietary method is provided to enable applications to programmatically determine whether or not to upgrade an individual request to WebSocket.Note: This method is not used by Tomcat but is used directly by third-party code and must not be removed.
- Parameters:
request- The request object to be upgradedresponse- The response object to be populated with the result of the upgradesec- The server endpoint to use to process the upgrade requestpathParams- The path parameters associated with the upgrade request- Throws:
ServletException- If a configuration error prevents the upgrade from taking placeIOException- If an I/O error occurs during the upgrade process
-
findMapping
-
isEnforceNoAddAfterHandshake
public boolean isEnforceNoAddAfterHandshake() -
setEnforceNoAddAfterHandshake
public void setEnforceNoAddAfterHandshake(boolean enforceNoAddAfterHandshake) -
getTimeout
-
registerSession
Overridden to make it visible to other classes in this package.- Overrides:
registerSessionin classWsWebSocketContainer
-
unregisterSession
Overridden to make it visible to other classes in this package.- Overrides:
unregisterSessionin classWsWebSocketContainer
-
closeAuthenticatedSession
-