Annotation Interface ServerEndpoint


@Retention(RUNTIME) @Target(TYPE) public @interface ServerEndpoint
Annotates a class as a WebSocket server endpoint. The annotation provides configuration information about the endpoint such as the URI path, subprotocols, encoders, decoders, and configurator.
  • Required Element Summary

    Required Elements
    Modifier and Type
    Required Element
    Description
    URI or URI-template that the annotated class should be mapped to.
  • Optional Element Summary

    Optional Elements
    Modifier and Type
    Optional Element
    Description
    The configurator class used to customize the WebSocket handshake.
    Class<? extends Decoder>[]
    The decoder classes that this server endpoint uses.
    Class<? extends Encoder>[]
    The encoder classes that this server endpoint uses.
    The sub-protocols that this server endpoint supports.
  • Element Details

    • value

      String value
      URI or URI-template that the annotated class should be mapped to.
      Returns:
      The URI or URI-template that the annotated class should be mapped to.
    • subprotocols

      String[] subprotocols
      The sub-protocols that this server endpoint supports.
      Returns:
      The list of supported sub-protocols
      Default:
      {}
    • decoders

      Class<? extends Decoder>[] decoders
      The decoder classes that this server endpoint uses.
      Returns:
      The list of decoder classes
      Default:
      {}
    • encoders

      Class<? extends Encoder>[] encoders
      The encoder classes that this server endpoint uses.
      Returns:
      The list of encoder classes
      Default:
      {}
    • configurator

      Class<? extends ServerEndpointConfig.Configurator> configurator
      The configurator class used to customize the WebSocket handshake.
      Returns:
      The configurator class
      Default:
      jakarta.websocket.server.ServerEndpointConfig.Configurator.class