パッケージ jakarta.websocket.server

クラス ServerEndpointConfig.Builder

java.lang.ObjectSE
jakarta.websocket.server.ServerEndpointConfig.Builder
含まれているインターフェース:
ServerEndpointConfig

public static final class ServerEndpointConfig.Builder extends ObjectSE
ServerEndpointConfig.Builder は、サーバーエンドポイントをデプロイする目的で ServerEndpointConfig.Builder オブジェクトを作成するために使用されるクラスです。

ここではいくつかの例を示します。

パスのみのエンドポイントのプレーン構成を構築します。

 
 ServerEndpointConfig config = ServerEndpointConfig.Builder.create(ProgrammaticEndpoint.class, "/foo").build();
 
 

サブプロトコルとカスタムコンフィギュレーターなしで構成を構築します。

 
 ServerEndpointConfig config = ServerEndpointConfig.Builder.create(ProgrammaticEndpoint.class, "/bar")
         .subprotocols(subprotocols)
         .configurator(new MyServerConfigurator())
         .build();
 
 
作成者:
dannycoward
  • 方法の詳細

    • create

      public static ServerEndpointConfig.Builder create(ClassSE<?> endpointClass, StringSE path)
      エンドポイントクラスの必須情報(プログラムまたはアノテーション付き)、使用する相対 URI または URI テンプレートを使用し、サブプロトコル、拡張機能、エンコーダー、デコーダー、カスタムコンフィギュレーターを使用せずにビルダーを作成します。
      パラメーター:
      endpointClass - 構成するエンドポイントのクラス
      path - エンドポイントがデプロイされる URI または URI テンプレート。末尾の "/" は無視され、パスは / で始まる必要があります。
      戻り値:
      ServerEndpointConfig.Builder の新しいインスタンス
    • build

      public ServerEndpointConfig build()
      このビルダーオブジェクトに設定されている現在の属性を使用して、構成オブジェクトを構築します。
      戻り値:
      新しい ServerEndpointConfig オブジェクト。
    • encoders

      public ServerEndpointConfig.Builder encoders(ListSE<ClassSE<? extends Encoder>> encoders)
      このビルダーのエンコーダ実装クラスのリストを設定します。
      パラメーター:
      encoders - エンコーダ
      戻り値:
      このビルダーインスタンス
    • decoders

      public ServerEndpointConfig.Builder decoders(ListSE<ClassSE<? extends Decoder>> decoders)
      構成で使用するデコーダー実装クラスを設定します。
      パラメーター:
      decoders - デコーダ
      戻り値:
      このビルダーインスタンス。
    • subprotocols

      public ServerEndpointConfig.Builder subprotocols(ListSE<StringSE> subprotocols)
      構成で使用するサブプロトコルを設定します。
      パラメーター:
      subprotocols - サブプロトコル。
      戻り値:
      このビルダーインスタンス
    • extensions

      public ServerEndpointConfig.Builder extensions(ListSE<Extension> extensions)
      構成で使用する拡張機能を設定します。
      パラメーター:
      extensions - 使用する拡張機能。
      戻り値:
      このビルダーインスタンス。
    • configurator

      public ServerEndpointConfig.Builder configurator(ServerEndpointConfig.Configurator serverEndpointConfigurator)
      このビルダーによってビルドされた構成オブジェクトで使用するカスタムコンフィギュレーターを設定します。
      パラメーター:
      serverEndpointConfigurator - コンフィギュレーター
      戻り値:
      このビルダーインスタンス