001/* 002 * Copyright 2002-2018 the original author or authors. 003 * 004 * Licensed under the Apache License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * https://www.apache.org/licenses/LICENSE-2.0 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 */ 016 017package org.springframework.web.reactive.socket.client; 018 019import javax.websocket.Session; 020import javax.websocket.WebSocketContainer; 021 022import org.apache.tomcat.websocket.WsWebSocketContainer; 023import reactor.core.publisher.MonoProcessor; 024 025import org.springframework.web.reactive.socket.HandshakeInfo; 026import org.springframework.web.reactive.socket.adapter.StandardWebSocketSession; 027import org.springframework.web.reactive.socket.adapter.TomcatWebSocketSession; 028 029/** 030 * {@link WebSocketClient} implementation for use with the Java WebSocket API. 031 * 032 * @author Violeta Georgieva 033 * @since 5.0 034 */ 035public class TomcatWebSocketClient extends StandardWebSocketClient { 036 037 038 public TomcatWebSocketClient() { 039 this(new WsWebSocketContainer()); 040 } 041 042 public TomcatWebSocketClient(WebSocketContainer webSocketContainer) { 043 super(webSocketContainer); 044 } 045 046 047 @Override 048 protected StandardWebSocketSession createWebSocketSession(Session session, 049 HandshakeInfo info, MonoProcessor<Void> completion) { 050 051 return new TomcatWebSocketSession(session, info, bufferFactory(), completion); 052 } 053 054}