public class WsServerContainer extends WsWebSocketContainer implements ServerContainer
| Modifier and Type | Method and Description |
|---|---|
void |
addEndpoint(Class<?> pojo)
Provides the equivalent of
addEndpoint(ServerEndpointConfig)
for publishing plain old java objects (POJOs) that have been annotated as
WebSocket endpoints. |
void |
addEndpoint(ServerEndpointConfig sec)
Published the provided endpoint implementation at the specified path with
the specified configuration.
|
void |
closeAuthenticatedSession(String httpSessionId) |
void |
doUpgrade(HttpServletRequest request,
HttpServletResponse response,
ServerEndpointConfig sec,
Map<String,String> pathParams)
Deprecated.
This method will be removed in Apache Tomcat 10.1 onwards. It
has been replaced by
upgradeHttpToWebSocket(Object,
Object, ServerEndpointConfig, Map) |
org.apache.tomcat.websocket.server.WsMappingResult |
findMapping(String path) |
protected InstanceManager |
getInstanceManager(ClassLoader classLoader)
Overridden to make it visible to other classes in this package.
|
protected WsWriteTimeout |
getTimeout() |
boolean |
isEnforceNoAddAfterHandshake() |
protected void |
registerSession(Object key,
WsSession wsSession)
Overridden to make it visible to other classes in this package.
|
void |
setEnforceNoAddAfterHandshake(boolean enforceNoAddAfterHandshake) |
protected void |
unregisterSession(Object key,
WsSession wsSession)
Overridden to make it visible to other classes in this package.
|
void |
upgradeHttpToWebSocket(Object httpServletRequest,
Object httpServletResponse,
ServerEndpointConfig sec,
Map<String,String> pathParameters)
Upgrade the HTTP connection represented by the
HttpServletRequest and HttpServletResponse to the
WebSocket protocol and establish a WebSocket connection as per the provided ServerEndpointConfig. |
backgroundProcess, connectToServer, connectToServer, connectToServer, connectToServer, destroy, getDefaultAsyncSendTimeout, getDefaultMaxBinaryMessageBufferSize, getDefaultMaxSessionIdleTimeout, getDefaultMaxTextMessageBufferSize, getInstalledExtensions, getProcessPeriod, setAsyncSendTimeout, setDefaultMaxBinaryMessageBufferSize, setDefaultMaxSessionIdleTimeout, setDefaultMaxTextMessageBufferSize, setInstanceManager, setProcessPeriodclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitconnectToServer, connectToServer, connectToServer, connectToServer, getDefaultAsyncSendTimeout, getDefaultMaxBinaryMessageBufferSize, getDefaultMaxSessionIdleTimeout, getDefaultMaxTextMessageBufferSize, getInstalledExtensions, setAsyncSendTimeout, setDefaultMaxBinaryMessageBufferSize, setDefaultMaxSessionIdleTimeout, setDefaultMaxTextMessageBufferSizepublic void addEndpoint(ServerEndpointConfig sec) throws DeploymentException
WsServerContainer(ServletContext)
must be called before calling this method.addEndpoint in interface ServerContainersec - The configuration to use when creating endpoint instancesDeploymentException - if the endpoint cannot be published as
requestedpublic void addEndpoint(Class<?> pojo) throws DeploymentException
addEndpoint(ServerEndpointConfig)
for publishing plain old java objects (POJOs) that have been annotated as
WebSocket endpoints.addEndpoint in interface ServerContainerpojo - The annotated POJODeploymentException@Deprecated public void doUpgrade(HttpServletRequest request, HttpServletResponse response, ServerEndpointConfig sec, Map<String,String> pathParams) throws ServletException, IOException
upgradeHttpToWebSocket(Object,
Object, ServerEndpointConfig, Map)Note: This method is not used by Tomcat but is used directly by third-party code and must not be removed.
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 requestServletException - If a configuration error prevents the upgrade
from taking placeIOException - If an I/O error occurs during the upgrade processpublic void upgradeHttpToWebSocket(Object httpServletRequest, Object httpServletResponse, ServerEndpointConfig sec, Map<String,String> pathParameters) throws IOException, DeploymentException
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.
This method will be part of the Jakarta WebSocket API from version 2.1
httpServletRequest - The HttpServletRequest to be processed as a WebSocket handshake as per
section 4.0 of RFC 6455.httpServletResponse - The HttpServletResponse to be used when processing the
httpServletRequest 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.IllegalStateException - if the provided request does not meet the requirements of the WebSocket handshakeUnsupportedOperationException - if the WebSocket implementation is not deployed as part of a Jakarta
Servlet containerIOException - if an I/O error occurs during the establishment of a WebSocket connectionDeploymentException - if a configuration error prevents the establishment of a WebSocket connectionpublic org.apache.tomcat.websocket.server.WsMappingResult findMapping(String path)
public boolean isEnforceNoAddAfterHandshake()
public void setEnforceNoAddAfterHandshake(boolean enforceNoAddAfterHandshake)
protected WsWriteTimeout getTimeout()
protected InstanceManager getInstanceManager(ClassLoader classLoader)
getInstanceManager in class WsWebSocketContainerprotected void registerSession(Object key, WsSession wsSession)
registerSession in class WsWebSocketContainerprotected void unregisterSession(Object key, WsSession wsSession)
unregisterSession in class WsWebSocketContainerpublic void closeAuthenticatedSession(String httpSessionId)
Copyright © 2000-2022 Apache Software Foundation. All Rights Reserved.