MCPcopy Index your code
hub / github.com/apache/tomcat / WsSession

Class WsSession

java/org/apache/tomcat/websocket/WsSession.java:67–1124  ·  view source on GitHub ↗

Implementation of a WebSocket session.

Source from the content-addressed store, hash-verified

65 * Implementation of a WebSocket session.
66 */
67public class WsSession implements Session {
68
69 private final Log log = LogFactory.getLog(WsSession.class); // must not be static
70 private static final StringManager sm = StringManager.getManager(WsSession.class);
71
72 // An ellipsis is a single character that looks like three periods in a row
73 // and is used to indicate a continuation.
74 private static final byte[] ELLIPSIS_BYTES = "\u2026".getBytes(StandardCharsets.UTF_8);
75 // An ellipsis is three bytes in UTF-8
76 private static final int ELLIPSIS_BYTES_LEN = ELLIPSIS_BYTES.length;
77
78 private static final boolean SEC_CONFIGURATOR_USES_IMPL_DEFAULT;
79
80 private static final AtomicLong ids = new AtomicLong(0);
81
82 static {
83 // Use fake end point and path. They are never used, they just need to
84 // be sufficient to pass the validation tests.
85 ServerEndpointConfig.Builder builder = ServerEndpointConfig.Builder.create(Object.class, "/");
86 ServerEndpointConfig sec = builder.build();
87 SEC_CONFIGURATOR_USES_IMPL_DEFAULT =
88 sec.getConfigurator().getClass().equals(DefaultServerEndpointConfigurator.class);
89 }
90
91 private final Endpoint localEndpoint;
92 private final WsRemoteEndpointImplBase wsRemoteEndpoint;
93 private final RemoteEndpoint.Async remoteEndpointAsync;
94 private final RemoteEndpoint.Basic remoteEndpointBasic;
95 private final ClassLoader applicationClassLoader;
96 private final WsWebSocketContainer webSocketContainer;
97 private final URI requestUri;
98 private final Map<String,List<String>> requestParameterMap;
99 private final String queryString;
100 private final Principal userPrincipal;
101 private final EndpointConfig endpointConfig;
102
103 private final List<Extension> negotiatedExtensions;
104 private final String subProtocol;
105 private final Map<String,String> pathParameters;
106 private final boolean secure;
107 private final String httpSessionId;
108 private final String id;
109
110 // Expected to handle message types of <String> only
111 private volatile MessageHandler textMessageHandler = null;
112 // Expected to handle message types of <ByteBuffer> only
113 private volatile MessageHandler binaryMessageHandler = null;
114 private volatile MessageHandler.Whole<PongMessage> pongMessageHandler = null;
115 private final AtomicReference<State> state = new AtomicReference<>(State.OPEN);
116 private final Map<String,Object> userProperties = new ConcurrentHashMap<>();
117 private volatile int maxBinaryMessageBufferSize = Constants.DEFAULT_BUFFER_SIZE;
118 private volatile int maxTextMessageBufferSize = Constants.DEFAULT_BUFFER_SIZE;
119 private volatile long maxIdleTimeout = 0;
120 private volatile long lastActiveRead = System.currentTimeMillis();
121 private volatile long lastActiveWrite = System.currentTimeMillis();
122 private final Map<FutureToSendHandler,FutureToSendHandler> futures = new ConcurrentHashMap<>();
123 private volatile Long sessionCloseTimeoutExpiry;
124

Callers

nothing calls this directly

Calls 7

getLogMethod · 0.95
getManagerMethod · 0.95
createMethod · 0.65
buildMethod · 0.65
equalsMethod · 0.65
getConfiguratorMethod · 0.65
getBytesMethod · 0.45

Tested by

no test coverage detected