org.apache.tomcat.websocket.server

## Class WsServerContainer

- java.lang.Object
- - org.apache.tomcat.websocket.WsWebSocketContainer
  - - org.apache.tomcat.websocket.server.WsServerContainer

All Implemented Interfaces:
  ServerContainer, WebSocketContainer, BackgroundProcess

    public class WsServerContainer
    extends WsWebSocketContainer
    implements ServerContainer

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.

- `Constants.BINARY_BUFFER_SIZE_SERVLET_CONTEXT_INIT_PARAM`
- `Constants.TEXT_BUFFER_SIZE_SERVLET_CONTEXT_INIT_PARAM`

### Field Summary

### Fields inherited from class org.apache.tomcat.websocket.WsWebSocketContainer

`IO_TIMEOUT_MS_DEFAULT, IO_TIMEOUT_MS_PROPERTY, SSL_CONTEXT_PROPERTY, SSL_PROTOCOLS_PROPERTY, SSL_TRUSTSTORE_PROPERTY, SSL_TRUSTSTORE_PWD_DEFAULT, SSL_TRUSTSTORE_PWD_PROPERTY`

### Method Summary

Methods
`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` `destroy()` Cleans up the resources still in use by WebSocket sessions created from this container.
`void` `doUpgrade(HttpServletRequest request, HttpServletResponse response, ServerEndpointConfig sec, Map<String,String> pathParams)`
`org.apache.tomcat.websocket.server.WsMappingResult` `findMapping(String path)`
`protected WsWriteTimeout` `getTimeout()`
`boolean` `isEnforceNoAddAfterHandshake()`
`protected void` `registerSession(Endpoint endpoint, WsSession wsSession)` Overridden to make it visible to other classes in this package.
`void` `setEnforceNoAddAfterHandshake(boolean enforceNoAddAfterHandshake)`
`protected void` `unregisterSession(Endpoint endpoint, 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, getDefaultAsyncSendTimeout, getDefaultMaxBinaryMessageBufferSize, getDefaultMaxSessionIdleTimeout, getDefaultMaxTextMessageBufferSize, getInstalledExtensions, getProcessPeriod, setAsyncSendTimeout, setDefaultMaxBinaryMessageBufferSize, setDefaultMaxSessionIdleTimeout, setDefaultMaxTextMessageBufferSize, setProcessPeriod`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Methods inherited from interface javax.websocket.WebSocketContainer

`connectToServer, connectToServer, connectToServer, connectToServer, getDefaultAsyncSendTimeout, getDefaultMaxBinaryMessageBufferSize, getDefaultMaxSessionIdleTimeout, getDefaultMaxTextMessageBufferSize, getInstalledExtensions, setAsyncSendTimeout, setDefaultMaxBinaryMessageBufferSize, setDefaultMaxSessionIdleTimeout, setDefaultMaxTextMessageBufferSize`

### Method Detail

#### addEndpoint

    public void addEndpoint(ServerEndpointConfig sec)
                     throws DeploymentException

Published the provided endpoint implementation at the specified path with the specified configuration. `WsServerContainer(ServletContext)` must be called before calling this method.

Specified by:
  `addEndpoint` in interface `ServerContainer`
Parameters:
  `sec` - The configuration to use when creating endpoint instances
Throws:
  `DeploymentException`

#### addEndpoint

    public void addEndpoint(Class<?> pojo)
                     throws DeploymentException

Provides the equivalent of `addEndpoint(ServerEndpointConfig)` for publishing plain old java objects (POJOs) that have been annotated as WebSocket endpoints.

Specified by:
  `addEndpoint` in interface `ServerContainer`
Parameters:
  `pojo` - The annotated POJO
Throws:
  `DeploymentException`

#### destroy

    public void destroy()

Description copied from class: `WsWebSocketContainer`
Cleans up the resources still in use by WebSocket sessions created from this container. This includes closing sessions and cancelling `Future`s associated with blocking read/writes.

Overrides:
  `destroy` in class `WsWebSocketContainer`

#### doUpgrade

    public void doUpgrade(HttpServletRequest request,
                 HttpServletResponse response,
                 ServerEndpointConfig sec,
                 Map<String,String> pathParams)
                   throws ServletException,
                          IOException

Throws:
  `ServletException`
  `IOException`

#### findMapping

    public org.apache.tomcat.websocket.server.WsMappingResult findMapping(String path)

#### isEnforceNoAddAfterHandshake

    public boolean isEnforceNoAddAfterHandshake()

#### setEnforceNoAddAfterHandshake

    public void setEnforceNoAddAfterHandshake(boolean enforceNoAddAfterHandshake)

#### getTimeout

    protected WsWriteTimeout getTimeout()

#### registerSession

    protected void registerSession(Endpoint endpoint,
                       WsSession wsSession)

Overridden to make it visible to other classes in this package.

Overrides:
  `registerSession` in class `WsWebSocketContainer`

#### unregisterSession

    protected void unregisterSession(Endpoint endpoint,
                         WsSession wsSession)

Overridden to make it visible to other classes in this package.

Overrides:
  `unregisterSession` in class `WsWebSocketContainer`

#### closeAuthenticatedSession

    public void closeAuthenticatedSession(String httpSessionId)