ServerEndpointConfig.Builder (WebSocket 2.2 API Documentation - Apache Tomcat 11.0.23)
Description: declaration: package: jakarta.websocket.server, interface: ServerEndpointConfig, class: Builder

# Class ServerEndpointConfig.Builder

java.lang.Object
jakarta.websocket.server.ServerEndpointConfig.Builder

Enclosing interface:
  `ServerEndpointConfig`

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

- ## Method Summary

  Modifier and Type
  Method
  Description
  `ServerEndpointConfig`
  `build()`
  Builds and returns a `ServerEndpointConfig` with the configured settings.
  `ServerEndpointConfig.Builder`
  `configurator(ServerEndpointConfig.Configurator serverEndpointConfigurator)`
  Sets the configurator to use for the WebSocket handshake.
  `static ServerEndpointConfig.Builder`
  `create(Class<?> endpointClass, String path)`
  Creates a new builder for the given endpoint class and path.
  `ServerEndpointConfig.Builder`
  `decoders(List<Class<? extends Decoder>> decoders)`
  Sets the list of decoder classes to use for the WebSocket connection.
  `ServerEndpointConfig.Builder`
  `encoders(List<Class<? extends Encoder>> encoders)`
  Sets the list of encoder classes to use for the WebSocket connection.
  `ServerEndpointConfig.Builder`
  `extensions(List<Extension> extensions)`
  Sets the list of extensions supported by the endpoint.
  `ServerEndpointConfig.Builder`
  `subprotocols(List<String> subprotocols)`
  Sets the list of sub-protocols supported by the endpoint.

  ### Methods inherited from class Object

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

- ## Method Details

  - ### create

    public static ServerEndpointConfig.Builder create(Class<?> endpointClass, String path)
    Creates a new builder for the given endpoint class and path.
    Parameters:
      `endpointClass` - The endpoint class
      `path` - The path at which the endpoint will be registered
    Returns:
      A new builder instance

  - ### build

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

  - ### encoders

    public ServerEndpointConfig.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 ServerEndpointConfig.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

  - ### subprotocols

    public ServerEndpointConfig.Builder subprotocols(List<String> subprotocols)
    Sets the list of sub-protocols supported by the endpoint.
    Parameters:
      `subprotocols` - The list of sub-protocols
    Returns:
      This builder instance

  - ### extensions

    public ServerEndpointConfig.Builder extensions(List<Extension> extensions)
    Sets the list of extensions supported by the endpoint.
    Parameters:
      `extensions` - The list of extensions
    Returns:
      This builder instance

  - ### configurator

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