ServerEndpointConfig.Builder . Certain configuration operations can be
customized by providing a ServerEndpointConfig.Configurator
| Modifier and Type | Class and Description |
|---|---|
| public static class | ServerEndpointConfig.
The ServerEndpointConfig.Builder is a class used for creating |
| public static class | ServerEndpointConfig.
The ServerEndpointConfig.Configurator class may be extended by developers who want to provide custom configuration algorithms, such as intercepting the opening handshake, or providing arbitrary methods and algorithms that can be accessed from each endpoint instance configured with this configurator. |
| Modifier and Type | Method and Description |
|---|---|
| public ServerEndpointConfig. | Returns: the configurator in use.Return the |
| public Class | Returns: the class of the endpoint, annotated or programmatic.Returns the Class of the endpoint this configuration is configuring. |
| public List | Returns: the list of extensions, the empty list if none.Return the websocket extensions configured. |
| public String | Returns: the relative path for this configuration.Return the path for this endpoint configuration. |
| public List | Returns: the list of subprotocols, the empty list if noneReturn the websocket subprotocols configured. |
| getConfigurator | back to summary |
|---|---|
| public ServerEndpointConfig. Return the
| |
| getEndpointClass | back to summary |
|---|---|
| public Class Returns the Class of the endpoint this configuration is configuring. If the endpoint is an annotated endpoint, the value is the class of the Java class annotated with @ServerEndpoint. if the endpoint is a programmatic, the value is the class of the subclass of Endpoint.
| |
| getExtensions | back to summary |
|---|---|
| public List Return the websocket extensions configured. | |
| getPath | back to summary |
|---|---|
| public String getPath() Return the path for this endpoint configuration. The path is the URI or URI-template (level 1) relative to the websocket root of the server to which the endpoint using this configuration will be mapped. The path is always non-null and always begins with a leading "/".
| |
| getSubprotocols | back to summary |
|---|---|
| public List Return the websocket subprotocols configured. | |
ServerEndpointConfig.Builder objects for
the purposes of deploying a server endpoint.
Here are some examples:
Building a plain configuration for an endpoint with just a path.
ServerEndpointConfig config = ServerEndpointConfig.Builder.create(ProgrammaticEndpoint.class, "/foo").build();
Building a configuration with no subprotocols and a custom configurator.
ServerEndpointConfig config = ServerEndpointConfig.Builder.create(ProgrammaticEndpoint.class, "/bar")
.subprotocols(subprotocols)
.configurator(new MyServerConfigurator())
.build();
| Modifier and Type | Field and Description |
|---|---|
| private List | |
| private List | |
| private Class | |
| private List | |
| private String | |
| private ServerEndpointConfig. | |
| private List |
| Access | Constructor and Description |
|---|---|
| private | |
| private |
| Modifier and Type | Method and Description |
|---|---|
| public ServerEndpointConfig | Returns: a new ServerEndpointConfig object.Builds the configuration object using the current attributes that have been set on this builder object. |
| public ServerEndpointConfig. | Returns: this builder instancethe configurator serverEndpointConfiguratorSets the custom configurator to use on the configuration object built by this builder. |
| public static ServerEndpointConfig. | Returns: a new instance of ServerEndpointConfig.Builderthe class of the endpoint to configure endpointClass, String The URI or URI template where the endpoint will be deployed. A trailing "/" will be
ignored and the path must begin with /. path)Creates the builder with the mandatory information of the endpoint class (programmatic or annotated), the relative URI or URI-template to use, and with no subprotocols, extensions, encoders, decoders or custom configurator. |
| public ServerEndpointConfig. | |
| public ServerEndpointConfig. | |
| public ServerEndpointConfig. | Returns: this builder instance.the extensions to use. extensions)Sets the extensions to use in the configuration. |
| public ServerEndpointConfig. | Returns: this builder instancethe subprotocols. subprotocols)Sets the subprotocols to use in the configuration. |
| decoders | back to summary |
|---|---|
| private List<Class<? extends Decoder>> decoders | |
| encoders | back to summary |
|---|---|
| private List<Class<? extends Encoder>> encoders | |
| endpointClass | back to summary |
|---|---|
| private Class<?> endpointClass | |
| extensions | back to summary |
|---|---|
| private List<Extension> extensions | |
| path | back to summary |
|---|---|
| private String path | |
| serverEndpointConfigurator | back to summary |
|---|---|
| private ServerEndpointConfig. | |
| subprotocols | back to summary |
|---|---|
| private List<String> subprotocols | |
| Builder | back to summary |
|---|---|
| private Builder() | |
| Builder | back to summary |
|---|---|
| private Builder(Class<?> endpointClass, String path) | |
| build | back to summary |
|---|---|
| public ServerEndpointConfig build() Builds the configuration object using the current attributes that have been set on this builder object.
| |
| configurator | back to summary |
|---|---|
| public ServerEndpointConfig. Sets the custom configurator to use on the configuration object built by this builder.
| |
| create | back to summary |
|---|---|
| public static ServerEndpointConfig. Creates the builder with the mandatory information of the endpoint class (programmatic or annotated), the relative URI or URI-template to use, and with no subprotocols, extensions, encoders, decoders or custom configurator.
| |
| decoders | back to summary |
|---|---|
| public ServerEndpointConfig. Sets the decoder implementation classes to use in the configuration.
| |
| encoders | back to summary |
|---|---|
| public ServerEndpointConfig. Sets the list of encoder implementation classes for this builder.
| |
| extensions | back to summary |
|---|---|
| public ServerEndpointConfig. Sets the extensions to use in the configuration.
| |
| subprotocols | back to summary |
|---|---|
| public ServerEndpointConfig. Sets the subprotocols to use in the configuration.
| |
| Modifier and Type | Field and Description |
|---|---|
| private ServerEndpointConfig. |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public boolean | Returns: whether the check passed or notthe value of the origin header passed by the client. originHeaderValue)Check the value of the Origin header (See Origin Header) the client passed during the opening handshake. |
| pack-priv static ServerEndpointConfig. | |
| public ServerEndpointConfig. | Returns: the platform default configuratorReturn the platform default configurator. |
| public < the type of the endpoint T> T | Returns: an instance of the endpoint that will handle all interactions from a new client.the class of the endpoint endpointClass)This method is called by the container each time a new client connects to the logical endpoint this configurator configures. |
| public List | Returns: the list of extensions negotiated, the empty list if none.the installed extensions on the implementation. installed, List<Extension> the requested extensions, in the order they were requested by the client requested)Return the ordered list of extensions that t server endpoint will support given the requested extension list passed in, the empty list if none. |
| public String | Returns: the negotiated subprotocol or the empty string if there isn't one.the subprotocols supported by the server endpoint supported, List<String> the requested subprotocols from the client endpoint requested)Return the subprotocol the server endpoint has chosen from the requested list supplied by a client who wishes to connect, or none if there wasn't one this server endpoint liked. |
| public void | modifyHandshake(ServerEndpointConfig
the configuration object involved in the handshake sec, HandshakeRequest the opening handshake request. request, HandshakeResponse the proposed opening handshake response response)Called by the container after it has formulated a handshake response resulting from a well-formed handshake request. |
| containerDefaultConfigurator | back to summary |
|---|---|
| private ServerEndpointConfig. | |
| Configurator | back to summary |
|---|---|
| public Configurator() | |
| checkOrigin | back to summary |
|---|---|
| public boolean checkOrigin(String originHeaderValue) Check the value of the Origin header (See Origin Header) the client passed during the opening handshake. The platform default implementation of this method makes a check of the validity of the Origin header sent along with the opening handshake following the recommendation at: Sending the Server's Opening Handshake.
| |
| fetchContainerDefaultConfigurator | back to summary |
|---|---|
| pack-priv static ServerEndpointConfig. | |
| getContainerDefaultConfigurator | back to summary |
|---|---|
| public ServerEndpointConfig. Return the platform default configurator.
| |
| getEndpointInstance | back to summary |
|---|---|
| public <T> T getEndpointInstance(Class<T> endpointClass) throws InstantiationException This method is called by the container each time a new client connects to the logical endpoint this configurator configures. Developers may override this method to control instantiation of endpoint instances in order to customize the initialization of the endpoint instance, or manage them in some other way. If the developer overrides this method, services like dependency injection that are otherwise supported, for example, when the implementation is part of the Java EE platform may not be available. The platform default implementation of this method returns a new endpoint instance per call, thereby ensuring that there is one endpoint instance per client, the default deployment cardinality.
| |
| getNegotiatedExtensions | back to summary |
|---|---|
| public List Return the ordered list of extensions that t server endpoint will support given the requested extension list passed in, the empty list if none. See Negotiating Extensions The default platform implementation of this method returns a list containing all of the requested extensions passed to this method that it supports, using the order in the requested extensions, the empty list if none. | |
| getNegotiatedSubprotocol | back to summary |
|---|---|
| public String getNegotiatedSubprotocol(List<String> supported, List<String> requested) Return the subprotocol the server endpoint has chosen from the requested list supplied by a client who wishes to connect, or none if there wasn't one this server endpoint liked. See Sending the Server's Opening Handshake. Subclasses may provide custom algorithms based on other factors. The default platform implementation of this method returns the first subprotocol in the list sent by the client that the server supports, or the empty string if there isn't one. | |
| modifyHandshake | back to summary |
|---|---|
| public void modifyHandshake(ServerEndpointConfig sec, HandshakeRequest request, HandshakeResponse response) Called by the container after it has formulated a handshake response resulting from a well-formed handshake request. The container has already checked that this configuration has a matching URI, determined the validity of the origin using the checkOrigin method, and filled out the negotiated subprotocols and extensions based on this configuration. Custom configurations may override this method in order to inspect the request parameters and modify the handshake response that the server has formulated. and the URI checking also. If the developer does not override this method, no further modification of the request and response are made by the implementation.
The user properties made available via
| |