public class OriginHandshakeInterceptor extends ObjectSE implements HandshakeInterceptor
Origin
ヘッダー値をチェックするインターセプター。コンストラクターと説明 |
---|
OriginHandshakeInterceptor() 同じオリジンリクエストのみが許可されたデフォルトコンストラクター。 |
OriginHandshakeInterceptor(CollectionSE<StringSE> allowedOrigins) 指定された許可された起点値を使用するコンストラクター。 |
修飾子と型 | メソッドと説明 |
---|---|
void | afterHandshake(ServerHttpRequest request, ServerHttpResponse response, WebSocketHandler wsHandler, ExceptionSE exception) ハンドシェイクが完了した後に呼び出されます。 |
boolean | beforeHandshake(ServerHttpRequest request, ServerHttpResponse response, WebSocketHandler wsHandler, MapSE<StringSE,ObjectSE> attributes) ハンドシェイクが処理される前に呼び出されます。 |
CollectionSE<StringSE> | getAllowedOrigins() 許可された Origin ヘッダー値を返します。 |
void | setAllowedOrigins(CollectionSE<StringSE> allowedOrigins) 許可された Origin ヘッダー値を構成します。 |
cloneSE, equalsSE, finalizeSE, getClassSE, hashCodeSE, notifySE, notifyAllSE, toStringSE, waitSE, waitSE, waitSE
protected final Log logger
public OriginHandshakeInterceptor()
public OriginHandshakeInterceptor(CollectionSE<StringSE> allowedOrigins)
public void setAllowedOrigins(CollectionSE<StringSE> allowedOrigins)
Origin
ヘッダー値を構成します。このチェックは主にブラウザー向けに設計されています。他のタイプのクライアントが Origin
ヘッダー値を変更するのを妨げるものは何もありません。提供される許可された各オリジンにはスキームがあり、オプションでポート(例:「https://example.org」、「https://example.org:9090」)が必要です。許可される発信元文字列は「*」でもかまいません。この場合、すべての発信元が許可されます。
public CollectionSE<StringSE> getAllowedOrigins()
Origin
ヘッダー値を返します。public boolean beforeHandshake(ServerHttpRequest request, ServerHttpResponse response, WebSocketHandler wsHandler, MapSE<StringSE,ObjectSE> attributes) throws ExceptionSE
HandshakeInterceptor
HandshakeInterceptor
の beforeHandshake
request
- 現在のリクエスト response
- 現在のレスポンス wsHandler
- ターゲット WebSocket ハンドラー attributes
- WebSocket セッションに関連付ける HTTP ハンドシェイクの属性。提供された属性がコピーされ、元のマップは使用されません。true
)を続行するか、中止するか (false
)ExceptionSE
public void afterHandshake(ServerHttpRequest request, ServerHttpResponse response, WebSocketHandler wsHandler, @Nullable ExceptionSE exception)
HandshakeInterceptor
HandshakeInterceptor
の afterHandshake
request
- 現在のリクエスト response
- 現在のレスポンス wsHandler
- ターゲット WebSocket ハンドラー exception
- ハンドシェイク中に発生した例外、ない場合は null