Class DefaultServerEndpointConfigurator
java.lang.Object
jakarta.websocket.server.ServerEndpointConfig.Configurator
org.apache.tomcat.websocket.server.DefaultServerEndpointConfigurator
Default implementation of
ServerEndpointConfig.Configurator for WebSocket server endpoints.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleancheckOrigin(String originHeaderValue) Checks whether the given Origin header value is acceptable.<T> TgetEndpointInstance(Class<T> clazz) Creates a new instance of the endpoint class.getNegotiatedExtensions(List<Extension> installed, List<Extension> requested) Determines the extensions to use for the WebSocket connection by comparing the installed and requested extensions.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.voidmodifyHandshake(ServerEndpointConfig sec, HandshakeRequest request, HandshakeResponse response) Provides the opportunity to modify the handshake before it is completed.Methods inherited from class ServerEndpointConfig.Configurator
getContainerDefaultConfigurator
-
Constructor Details
-
DefaultServerEndpointConfigurator
public DefaultServerEndpointConfigurator()Default constructor.
-
-
Method Details
-
getEndpointInstance
Description copied from class:jakarta.websocket.server.ServerEndpointConfig.ConfiguratorCreates a new instance of the endpoint class.- Overrides:
getEndpointInstancein classServerEndpointConfig.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
Description copied from class:jakarta.websocket.server.ServerEndpointConfig.ConfiguratorDetermines the sub-protocol to use for the WebSocket connection by comparing the supported and requested sub-protocols.- Overrides:
getNegotiatedSubprotocolin classServerEndpointConfig.Configurator- Parameters:
supported- The list of sub-protocols supported by the endpointrequested- The list of sub-protocols requested by the client- Returns:
- The negotiated sub-protocol, or
nullif none matches
-
getNegotiatedExtensions
public List<Extension> getNegotiatedExtensions(List<Extension> installed, List<Extension> requested) Description copied from class:jakarta.websocket.server.ServerEndpointConfig.ConfiguratorDetermines the extensions to use for the WebSocket connection by comparing the installed and requested extensions.- Overrides:
getNegotiatedExtensionsin classServerEndpointConfig.Configurator- Parameters:
installed- The list of extensions installed on the serverrequested- The list of extensions requested by the client- Returns:
- The list of negotiated extensions
-
checkOrigin
Description copied from class:jakarta.websocket.server.ServerEndpointConfig.ConfiguratorChecks whether the given Origin header value is acceptable. The default implementation always returnstrue.- Overrides:
checkOriginin classServerEndpointConfig.Configurator- Parameters:
originHeaderValue- The Origin header value to check- Returns:
trueif the origin is acceptable
-
modifyHandshake
public void modifyHandshake(ServerEndpointConfig sec, HandshakeRequest request, HandshakeResponse response) Description copied from class:jakarta.websocket.server.ServerEndpointConfig.ConfiguratorProvides the opportunity to modify the handshake before it is completed. This method is called after the sub-protocol and extensions have been negotiated.- Overrides:
modifyHandshakein classServerEndpointConfig.Configurator- Parameters:
sec- The server endpoint configurationrequest- The handshake requestresponse- The handshake response
-