Package javax.websocket
Class ClientEndpointConfig.Builder
java.lang.Object
javax.websocket.ClientEndpointConfig.Builder
- Enclosing interface:
- ClientEndpointConfig
The ClientEndpointConfig.Builder is a class used for creating
ClientEndpointConfig
objects for the purposes of
deploying a client endpoint.
Here are some examples:
Building a plain configuration with no encoders, decoders, subprotocols or extensions.
ClientEndpointConfig cec = ClientEndpointConfig.Builder.create().build();
Building a configuration with no subprotocols and a custom configurator.
ClientEndpointConfig customCec = ClientEndpointConfig.Builder.create()
.preferredSubprotocols(mySubprotocols)
.configurator(new MyClientConfigurator())
.build();
-
Method Summary
Modifier and TypeMethodDescriptionbuild()
Builds a configuration object using the attributes set on this builder.configurator
(ClientEndpointConfig.Configurator clientEndpointConfigurator) Sets the configurator object for the configuration this builder will build.static ClientEndpointConfig.Builder
create()
Creates a new builder object with no subprotocols, extensions, encoders, decoders and anull
configurator.Assign the list of decoder implementation classes the client will use.Assign the list of encoder implementation classes the client will use.extensions
(List<Extension> extensions) Set the extensions for the configuration this builder will build.preferredSubprotocols
(List<String> preferredSubprotocols) Set the preferred sub protocols for the configuration this builder will build.
-
Method Details
-
create
Creates a new builder object with no subprotocols, extensions, encoders, decoders and anull
configurator.- Returns:
- a new builder object.
-
build
Builds a configuration object using the attributes set on this builder.- Returns:
- a new configuration object.
-
configurator
public ClientEndpointConfig.Builder configurator(ClientEndpointConfig.Configurator clientEndpointConfigurator) Sets the configurator object for the configuration this builder will build.- Parameters:
clientEndpointConfigurator
- the configurator- Returns:
- the builder instance
-
preferredSubprotocols
Set the preferred sub protocols for the configuration this builder will build. The list is treated in order of preference, favorite first, that this client would like to use for its sessions.- Parameters:
preferredSubprotocols
- the preferred subprotocol names.- Returns:
- the builder instance
-
extensions
Set the extensions for the configuration this builder will build. The list is treated in order of preference, favorite first, that the client would like to use for its sessions.- Parameters:
extensions
- the extensions- Returns:
- the builder instance
-
encoders
Assign the list of encoder implementation classes the client will use.- Parameters:
encoders
- the encoder implementation classes- Returns:
- the builder instance
-
decoders
Assign the list of decoder implementation classes the client will use.- Parameters:
decoders
- the decoder implementation classes- Returns:
- this builder instance
-