javax.websocket.server
Class ServerEndpointConfigurationBuilder

java.lang.Object
  extended by javax.websocket.server.ServerEndpointConfigurationBuilder

public final class ServerEndpointConfigurationBuilder
extends Object

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

Here are some examples:

Building a plain configuration for an endpoint with just a path.

ServerEndpointConfiguration config = ServerEndpointConfigurationBuilder.create(ProgrammaticEndpoint.class, "/foo").build();


Building a configuration with no subprotocols and a custom configurator.

ServerEndpointConfiguration config = ServerEndpointConfigurationBuilder.create(ProgrammaticEndpoint.class, "/bar")
.subprotocols(subprotocols)
.serverEndpointConfigurator(new MyServerConfigurator())
.build();

Author:
dannycoward

Method Summary
 ServerEndpointConfiguration build()
          Builds the configuration object using the current attributes that have been set on this builder object.
static ServerEndpointConfigurationBuilder create(Class endpointClass, String 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.
 ServerEndpointConfigurationBuilder decoders(List<Decoder> decoders)
          Sets the decoders to use in the configuration.
 ServerEndpointConfigurationBuilder encoders(List<Encoder> encoders)
          Sets the list of encoders for this builder.
 ServerEndpointConfigurationBuilder extensions(List<Extension> extensions)
          Sets the extensions to use in the configuration.
 ServerEndpointConfigurationBuilder serverEndpointConfigurator(ServerEndpointConfigurator serverEndpointConfigurator)
          Sets the custom configurator to use on the configuration object built by this builder.
 ServerEndpointConfigurationBuilder subprotocols(List<String> subprotocols)
          Sets the subprotocols to use in the configuration.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

create

public static ServerEndpointConfigurationBuilder create(Class endpointClass,
                                                        String 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.

Parameters:
endpointClass - the class of the endpoint to configure
path - The URI or URI template where the endpoint will be deployed. A trailing "/" will be ignored and the path must begin with /.
Returns:
a new instance of ServerEndpointConfigurationBuilder

build

public ServerEndpointConfiguration build()
Builds the configuration object using the current attributes that have been set on this builder object.

Returns:
a new ServerEndpointConfiguration object.

encoders

public ServerEndpointConfigurationBuilder encoders(List<Encoder> encoders)
Sets the list of encoders for this builder.

Parameters:
encoders - the encoders
Returns:
this builder instance

decoders

public ServerEndpointConfigurationBuilder decoders(List<Decoder> decoders)
Sets the decoders to use in the configuration.

Parameters:
decoders - the decoders
Returns:
this builder instance.

subprotocols

public ServerEndpointConfigurationBuilder subprotocols(List<String> subprotocols)
Sets the subprotocols to use in the configuration.

Parameters:
subprotocols - the subprotocols.
Returns:
this builder instance

extensions

public ServerEndpointConfigurationBuilder extensions(List<Extension> extensions)
Sets the extensions to use in the configuration.

Parameters:
extensions - the extensions to use.
Returns:
this builder instance.

serverEndpointConfigurator

public ServerEndpointConfigurationBuilder serverEndpointConfigurator(ServerEndpointConfigurator serverEndpointConfigurator)
Sets the custom configurator to use on the configuration object built by this builder.

Parameters:
serverEndpointConfigurator - the configurator
Returns:
this builder instance


Copyright © 2012-2013, Oracle and/or its affiliates. All Rights Reserved. Use is subject to license terms.
Comments to : users@websocket-spec.java.net