Top Description Inners Methods
javax.websocket

public Interface ClientEndpointConfig

extends EndpointConfig
Known Direct Implementers
javax.websocket.DefaultClientEndpointConfig
Imports
java.util.ArrayList, .Collections, .List, .Map

The ClientEndpointConfig is a special kind of endpoint configuration object that contains web socket configuration information specific only to client endpoints. Developers deploying programmatic client endpoints can create instances of this configuration by using a ClientEndpointConfig.Builder. Developers can override some of the configuration operations by providing an implementation of ClientEndpointConfig.Configurator.
Author
dannycoward

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static class
ClientEndpointConfig.Builder

The ClientEndpointConfig.Builder is a class used for creating ClientEndpointConfig objects for the purposes of deploying a client endpoint.

public static class
ClientEndpointConfig.Configurator

The 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.

Method Summary

Modifier and TypeMethod and Description
public ClientEndpointConfig.Configurator

Returns:

the configurator in use with this configuration.
getConfigurator
()

Return the custom configurator for this configuration.

public List<Extension>

Returns:

the list of extensions, the empty list if there are none.
getExtensions
()

Return the extensions, in order of preference, favorite first, that this client would like to use for its sessions.

public List<String>

Returns:

the list of the preferred subprotocols, the empty list if there are none
getPreferredSubprotocols
()

Return the ordered list of sub protocols a client endpoint would like to use, in order of preference, favorite first that this client would like to use for its sessions.

Inherited from javax.websocket.EndpointConfig:
getDecodersgetEncodersgetUserProperties

Method Detail

getConfiguratorback to summary
public ClientEndpointConfig.Configurator getConfigurator()

Return the custom configurator for this configuration. If the developer did not provide one, the platform default configurator is returned.

Returns:ClientEndpointConfig.Configurator

the configurator in use with this configuration.

getExtensionsback to summary
public List<Extension> getExtensions()

Return the extensions, in order of preference, favorite first, that this client would like to use for its sessions. These are the extensions that will be used to populate the Sec-WebSocket-Extensions header in the opening handshake for clients using this configuration. The first extension in the list is the most preferred extension. See Negotiating Extensions.

Returns:List<Extension>

the list of extensions, the empty list if there are none.

getPreferredSubprotocolsback to summary
public List<String> getPreferredSubprotocols()

Return the ordered list of sub protocols a client endpoint would like to use, in order of preference, favorite first that this client would like to use for its sessions. This list is used to generate the Sec-WebSocket-Protocol header in the opening handshake for clients using this configuration. The first protocol name is the most preferred. See Client Opening Handshake.

Returns:List<String>

the list of the preferred subprotocols, the empty list if there are none

javax.websocket back to summary

public final Class ClientEndpointConfig.Builder

extends Object
Class Inheritance

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();
Author
dannycoward

Field Summary

Modifier and TypeField and Description
private ClientEndpointConfig.Configurator
private List<Class<? extends Decoder>>
private List<Class<? extends Encoder>>
private List<Extension>
private List<String>

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public ClientEndpointConfig

Returns:

a new configuration object.
build
()

Builds a configuration object using the attributes set on this builder.

public ClientEndpointConfig.Builder

Returns:

the builder instance
configurator
(ClientEndpointConfig.Configurator
the configurator
clientEndpointConfigurator
)

Sets the configurator object for the configuration this builder will build.

public static ClientEndpointConfig.Builder

Returns:

a new builder object.
create
()

Creates a new builder object with no subprotocols, extensions, encoders, decoders and a null configurator.

public ClientEndpointConfig.Builder

Returns:

this builder instance
decoders
(List<Class<? extends Decoder>>
the decoder implementation classes
decoders
)

Assign the list of decoder implementation classes the client will use.

public ClientEndpointConfig.Builder

Returns:

the builder instance
encoders
(List<Class<? extends Encoder>>
the encoder implementation classes
encoders
)

Assign the list of encoder implementation classes the client will use.

public ClientEndpointConfig.Builder

Returns:

the builder instance
extensions
(List<Extension>
the extensions
extensions
)

Set the extensions for the configuration this builder will build.

public ClientEndpointConfig.Builder

Returns:

the builder instance
preferredSubprotocols
(List<String>
the preferred subprotocol names.
preferredSubprotocols
)

Set the preferred sub protocols for the configuration this builder will build.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

clientEndpointConfiguratorback to summary
private ClientEndpointConfig.Configurator clientEndpointConfigurator
decodersback to summary
private List<Class<? extends Decoder>> decoders
encodersback to summary
private List<Class<? extends Encoder>> encoders
extensionsback to summary
private List<Extension> extensions
preferredSubprotocolsback to summary
private List<String> preferredSubprotocols

Constructor Detail

Builderback to summary
private Builder()

Method Detail

buildback to summary
public ClientEndpointConfig build()

Builds a configuration object using the attributes set on this builder.

Returns:ClientEndpointConfig

a new configuration object.

configuratorback to summary
public ClientEndpointConfig.Builder configurator(ClientEndpointConfig.Configurator clientEndpointConfigurator)

Sets the configurator object for the configuration this builder will build.

Parameters
clientEndpointConfigurator:ClientEndpointConfig.Configurator

the configurator

Returns:ClientEndpointConfig.Builder

the builder instance

createback to summary
public static ClientEndpointConfig.Builder create()

Creates a new builder object with no subprotocols, extensions, encoders, decoders and a null configurator.

Returns:ClientEndpointConfig.Builder

a new builder object.

decodersback to summary
public ClientEndpointConfig.Builder decoders(List<Class<? extends Decoder>> decoders)

Assign the list of decoder implementation classes the client will use.

Parameters
decoders:List<Class<? extends Decoder>>

the decoder implementation classes

Returns:ClientEndpointConfig.Builder

this builder instance

encodersback to summary
public ClientEndpointConfig.Builder encoders(List<Class<? extends Encoder>> encoders)

Assign the list of encoder implementation classes the client will use.

Parameters
encoders:List<Class<? extends Encoder>>

the encoder implementation classes

Returns:ClientEndpointConfig.Builder

the builder instance

extensionsback to summary
public ClientEndpointConfig.Builder extensions(List<Extension> 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:List<Extension>

the extensions

Returns:ClientEndpointConfig.Builder

the builder instance

preferredSubprotocolsback to summary
public ClientEndpointConfig.Builder preferredSubprotocols(List<String> 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:List<String>

the preferred subprotocol names.

Returns:ClientEndpointConfig.Builder

the builder instance

javax.websocket back to summary

public Class ClientEndpointConfig.Configurator

extends Object
Class Inheritance

The 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.

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public void
afterResponse(HandshakeResponse
the handshake response sent by the server.
hr
)

This method is called by the implementation after it has received a handshake response from the server as a result of a handshake interaction it initiated.

public void
beforeRequest(Map<String, List<String>>
the mutable map of handshake request headers the implementation is about to send to start the handshake interaction.
headers
)

This method is called by the implementation after it has formulated the handshake request that will be used to initiate the connection to the server, but before it has sent any part of the request.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

Configuratorback to summary
public Configurator()

Method Detail

afterResponseback to summary
public void afterResponse(HandshakeResponse hr)

This method is called by the implementation after it has received a handshake response from the server as a result of a handshake interaction it initiated. The developer may implement this method in order to inspect the returning handshake response.

Parameters
hr:HandshakeResponse

the handshake response sent by the server.

beforeRequestback to summary
public void beforeRequest(Map<String, List<String>> headers)

This method is called by the implementation after it has formulated the handshake request that will be used to initiate the connection to the server, but before it has sent any part of the request. This allows the developer to inspect and modify the handshake request headers prior to the start of the handshake interaction.

Parameters
headers:Map<String, List<String>>

the mutable map of handshake request headers the implementation is about to send to start the handshake interaction.