DefaultServerEndpointConfigurator (Apache Tomcat 10.1.57 API Documentation)
Description: declaration: package: org.apache.tomcat.websocket.server, class: DefaultServerEndpointConfigurator

# Class DefaultServerEndpointConfigurator

java.lang.Object
jakarta.websocket.server.ServerEndpointConfig.Configurator
org.apache.tomcat.websocket.server.DefaultServerEndpointConfigurator

public class DefaultServerEndpointConfigurator extends ServerEndpointConfig.Configurator
Default implementation of `ServerEndpointConfig.Configurator` for WebSocket server endpoints.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `DefaultServerEndpointConfigurator()`
  Default constructor.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `boolean`
  `checkOrigin(String originHeaderValue)`
  Checks whether the given Origin header value is acceptable.
  `<T> T`
  `getEndpointInstance(Class<T> clazz)`
  Creates a new instance of the endpoint class.
  `List<Extension>`
  `getNegotiatedExtensions(List<Extension> installed, List<Extension> requested)`
  Determines the extensions to use for the WebSocket connection by comparing the installed and requested extensions.
  `String`
  `getNegotiatedSubprotocol(List<String> supported, List<String> requested)`
  Determines the sub-protocol to use for the WebSocket connection by comparing the supported and requested sub-protocols.
  `void`
  `modifyHandshake(ServerEndpointConfig sec, HandshakeRequest request, HandshakeResponse response)`
  Provides the opportunity to modify the handshake before it is completed.

  ### Methods inherited from class ServerEndpointConfig.Configurator

  `getContainerDefaultConfigurator`

  ### Methods inherited from class Object

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

- ## Constructor Details

  - ### DefaultServerEndpointConfigurator

    public DefaultServerEndpointConfigurator()
    Default constructor.

- ## Method Details

  - ### getEndpointInstance

    public <T> T getEndpointInstance(Class<T> clazz) throws InstantiationException
    Description copied from class: `jakarta.websocket.server.ServerEndpointConfig.Configurator`
    Creates a new instance of the endpoint class.
    Overrides:
      `getEndpointInstance` in class `ServerEndpointConfig.Configurator`
    Type Parameters:
      `T` - The type of the endpoint class
    Parameters:
      `clazz` - The endpoint class
    Returns:
      A new instance of the endpoint
    Throws:
      `InstantiationException` - If the endpoint cannot be instantiated

  - ### getNegotiatedSubprotocol

    public String getNegotiatedSubprotocol(List<String> supported, List<String> requested)
    Description copied from class: `jakarta.websocket.server.ServerEndpointConfig.Configurator`
    Determines the sub-protocol to use for the WebSocket connection by comparing the supported and requested sub-protocols.
    Overrides:
      `getNegotiatedSubprotocol` in class `ServerEndpointConfig.Configurator`
    Parameters:
      `supported` - The list of sub-protocols supported by the endpoint
      `requested` - The list of sub-protocols requested by the client
    Returns:
      The negotiated sub-protocol, or `null` if none matches

  - ### getNegotiatedExtensions

    public List<Extension> getNegotiatedExtensions(List<Extension> installed, List<Extension> requested)
    Description copied from class: `jakarta.websocket.server.ServerEndpointConfig.Configurator`
    Determines the extensions to use for the WebSocket connection by comparing the installed and requested extensions.
    Overrides:
      `getNegotiatedExtensions` in class `ServerEndpointConfig.Configurator`
    Parameters:
      `installed` - The list of extensions installed on the server
      `requested` - The list of extensions requested by the client
    Returns:
      The list of negotiated extensions

  - ### checkOrigin

    public boolean checkOrigin(String originHeaderValue)
    Description copied from class: `jakarta.websocket.server.ServerEndpointConfig.Configurator`
    Checks whether the given Origin header value is acceptable. The default implementation always returns `true`.
    Overrides:
      `checkOrigin` in class `ServerEndpointConfig.Configurator`
    Parameters:
      `originHeaderValue` - The Origin header value to check
    Returns:
      `true` if the origin is acceptable

  - ### modifyHandshake

    public void modifyHandshake(ServerEndpointConfig sec, HandshakeRequest request, HandshakeResponse response)
    Description copied from class: `jakarta.websocket.server.ServerEndpointConfig.Configurator`
    Provides the opportunity to modify the handshake before it is completed. This method is called after the sub-protocol and extensions have been negotiated.
    Overrides:
      `modifyHandshake` in class `ServerEndpointConfig.Configurator`
    Parameters:
      `sec` - The server endpoint configuration
      `request` - The handshake request
      `response` - The handshake response