public static void install(WebSocketTransport webSocketTransport, ServletContext servletContext) throws DeploymentException {
String contextPath = servletContext.getContextPath();
if (contextPath == null) contextPath = "";
if (! contextPath.startsWith("/")) contextPath = "/" + contextPath;
if (contextPath.endsWith("/")) contextPath = contextPath.substring(0, contextPath.length() - 1);
if (log.isDebugEnabled()) log.debug("Context Path: " + contextPath);
String endpointPath = webSocketTransport.getEndpointPath();
if (endpointPath == null) endpointPath = "";
if (! endpointPath.startsWith("/")) endpointPath = "/" + endpointPath;
if (endpointPath.endsWith("/")) endpointPath = endpointPath.substring(0, endpointPath.length() - 1);
if (log.isDebugEnabled()) log.debug("Endpoint Path: " + endpointPath);
ServerContainer serverContainer = (ServerContainer) servletContext.getAttribute("javax.websocket.server.ServerContainer");
if (serverContainer == null) throw new DeploymentException("Cannot find ServerContainer");
long oldDefaultMaxSessionIdleTimeout = serverContainer.getDefaultMaxSessionIdleTimeout();
long newDefaultMaxSessionIdleTimeout = 0;
serverContainer.setDefaultMaxSessionIdleTimeout(newDefaultMaxSessionIdleTimeout);
if (log.isDebugEnabled()) log.debug("Changed default max session idle timeout from " + oldDefaultMaxSessionIdleTimeout + " to " + newDefaultMaxSessionIdleTimeout);
install(serverContainer, webSocketTransport, contextPath, endpointPath, "/{path}");
for (UriMessagingContainerFactoryMount messagingContainerFactoryMount : webSocketTransport.getUriMessagingContainerRegistry().getMessagingContainerFactoryMounts()) {
install(serverContainer, webSocketTransport, contextPath, endpointPath, messagingContainerFactoryMount.getMessagingContainerFactoryPath() + "/{path}");
}
}