ClientEndpointConfig.Builder (WebSocket 2.1 API Documentation - Apache Tomcat 10.1.57)
Description: declaration: package: jakarta.websocket, interface: ClientEndpointConfig, class: Builder

# Class ClientEndpointConfig.Builder

java.lang.Object
jakarta.websocket.ClientEndpointConfig.Builder

Enclosing interface:
  `ClientEndpointConfig`

public static final class ClientEndpointConfig.Builder extends Object
Builder for creating `ClientEndpointConfig` instances.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `ClientEndpointConfig`
  `build()`
  Builds and returns a `ClientEndpointConfig` with the configured settings.
  `ClientEndpointConfig.Builder`
  `configurator(ClientEndpointConfig.Configurator configurator)`
  Sets the configurator to use for the WebSocket handshake.
  `static ClientEndpointConfig.Builder`
  `create()`
  Creates a new `ClientEndpointConfig.Builder` instance for building a `ClientEndpointConfig`.
  `ClientEndpointConfig.Builder`
  `decoders(List<Class<? extends Decoder>> decoders)`
  Sets the list of decoder classes to use for the WebSocket connection.
  `ClientEndpointConfig.Builder`
  `encoders(List<Class<? extends Encoder>> encoders)`
  Sets the list of encoder classes to use for the WebSocket connection.
  `ClientEndpointConfig.Builder`
  `extensions(List<Extension> extensions)`
  Sets the list of extensions to use for the WebSocket connection.
  `ClientEndpointConfig.Builder`
  `preferredSubprotocols(List<String> preferredSubprotocols)`
  Sets the list of preferred sub-protocols for the WebSocket connection.
  `ClientEndpointConfig.Builder`
  `sslContext(SSLContext sslContext)`
  Sets the SSL context to use for secure WebSocket connections.

  ### Methods inherited from class Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Method Details

  - ### create

    public static ClientEndpointConfig.Builder create()
    Creates a new `ClientEndpointConfig.Builder` instance for building a `ClientEndpointConfig`.
    Returns:
      A new builder instance

  - ### build

    public ClientEndpointConfig build()
    Builds and returns a `ClientEndpointConfig` with the configured settings.
    Returns:
      The configured client endpoint configuration

  - ### configurator

    public ClientEndpointConfig.Builder configurator(ClientEndpointConfig.Configurator configurator)
    Sets the configurator to use for the WebSocket handshake.
    Parameters:
      `configurator` - The configurator, or `null` to use the default
    Returns:
      This builder instance

  - ### preferredSubprotocols

    public ClientEndpointConfig.Builder preferredSubprotocols(List<String> preferredSubprotocols)
    Sets the list of preferred sub-protocols for the WebSocket connection.
    Parameters:
      `preferredSubprotocols` - The list of sub-protocols in order of preference
    Returns:
      This builder instance

  - ### extensions

    public ClientEndpointConfig.Builder extensions(List<Extension> extensions)
    Sets the list of extensions to use for the WebSocket connection.
    Parameters:
      `extensions` - The list of extensions
    Returns:
      This builder instance

  - ### encoders

    public ClientEndpointConfig.Builder encoders(List<Class<? extends Encoder>> encoders)
    Sets the list of encoder classes to use for the WebSocket connection.
    Parameters:
      `encoders` - The list of encoder classes
    Returns:
      This builder instance

  - ### decoders

    public ClientEndpointConfig.Builder decoders(List<Class<? extends Decoder>> decoders)
    Sets the list of decoder classes to use for the WebSocket connection.
    Parameters:
      `decoders` - The list of decoder classes
    Returns:
      This builder instance

  - ### sslContext

    public ClientEndpointConfig.Builder sslContext(SSLContext sslContext)
    Sets the SSL context to use for secure WebSocket connections.
    Parameters:
      `sslContext` - The SSL context, or `null` for default SSL behavior
    Returns:
      This builder instance