T
- ネイティブセッション型 public abstract class AbstractWebSocketSession<T> extends java.lang.Object implements NativeWebSocketSession
WebSocketSession
の実装の抽象基本クラス。修飾子と型 | フィールドと説明 |
---|---|
protected static IdGenerator | idGenerator |
protected static Log | logger |
コンストラクターと説明 |
---|
AbstractWebSocketSession(java.util.Map<java.lang.String,java.lang.Object> attributes) 新しいインスタンスを作成し、指定された属性をそれに関連付けます。 |
修飾子と型 | メソッドと説明 |
---|---|
protected void | checkNativeSessionInitialized() |
void | close() ステータス 1000 で WebSocket 接続を閉じます。 |
void | close(CloseStatus status) 指定されたクローズ状態で WebSocket 接続を閉じます。 |
protected abstract void | closeInternal(CloseStatus status) |
java.util.Map<java.lang.String,java.lang.Object> | getAttributes() WebSocket セッションに関連付けられた属性を持つマップを返します。 |
T | getNativeSession() 基礎となるネイティブ WebSocketSession を返します。 |
<R> R | getNativeSession(java.lang.Class<R> requiredType) 使用可能な場合、基礎となるネイティブ WebSocketSession を返します。 |
void | initializeNativeSession(T session) |
protected abstract void | sendBinaryMessage(BinaryMessage message) |
void | sendMessage(WebSocketMessage<?> message) WebSocket メッセージを送信する: TextMessage または BinaryMessage のいずれか。 |
protected abstract void | sendPingMessage(PingMessage message) |
protected abstract void | sendPongMessage(PongMessage message) |
protected abstract void | sendTextMessage(TextMessage message) |
java.lang.String | toString() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getAcceptedProtocol, getBinaryMessageSizeLimit, getExtensions, getHandshakeHeaders, getId, getLocalAddress, getPrincipal, getRemoteAddress, getTextMessageSizeLimit, getUri, isOpen, setBinaryMessageSizeLimit, setTextMessageSizeLimit
protected static final IdGenerator idGenerator
protected static final Log logger
public AbstractWebSocketSession(@Nullable java.util.Map<java.lang.String,java.lang.Object> attributes)
attributes
- WebSocket セッションに関連付ける HTTP ハンドシェイクの属性。指定された属性はコピーされ、元のマップは使用されません。public java.util.Map<java.lang.String,java.lang.Object> getAttributes()
WebSocketSession
サーバー側では、最初に HandshakeInterceptor
を介してマップにデータを入力できます。クライアント側では、WebSocketClient
ハンドシェイクメソッドを介してマップにデータを入力できます。
WebSocketSession
の getAttributes
null
)public T getNativeSession()
NativeWebSocketSession
NativeWebSocketSession
の getNativeSession
@Nullable public <R> R getNativeSession(@Nullable java.lang.Class<R> requiredType)
NativeWebSocketSession
NativeWebSocketSession
の getNativeSession
requiredType
- 必要なセッションの型 null
public void initializeNativeSession(T session)
protected final void checkNativeSessionInitialized()
public final void sendMessage(WebSocketMessage<?> message) throws java.io.IOException
WebSocketSession
TextMessage
または BinaryMessage
のいずれか。 注意 : 基礎となる標準 WebSocket セッション(JSR-356)は同時送信を許可しません。送信を同期する必要があります。これを確実にするための 1 つのオプションは、WebSocketSession
を ConcurrentWebSocketSessionDecorator
でラップすることです。
WebSocketSession
の sendMessage
java.io.IOException
ConcurrentWebSocketSessionDecorator
protected abstract void sendTextMessage(TextMessage message) throws java.io.IOException
java.io.IOException
protected abstract void sendBinaryMessage(BinaryMessage message) throws java.io.IOException
java.io.IOException
protected abstract void sendPingMessage(PingMessage message) throws java.io.IOException
java.io.IOException
protected abstract void sendPongMessage(PongMessage message) throws java.io.IOException
java.io.IOException
public final void close() throws java.io.IOException
WebSocketSession
session.close(CloseStatus.NORMAL);
java.io.Closeable
の close
java.lang.AutoCloseable
の close
WebSocketSession
の close
java.io.IOException
public final void close(CloseStatus status) throws java.io.IOException
WebSocketSession
WebSocketSession
の close
java.io.IOException
protected abstract void closeInternal(CloseStatus status) throws java.io.IOException
java.io.IOException
public java.lang.String toString()
java.lang.Object
の toString