Top Description Inners Methods
org.glassfish.tyrus.core

public Interface TyrusServerEndpointConfig

extends ServerEndpointConfig
Known Direct Implementers
org.glassfish.tyrus.core.DefaultTyrusServerEndpointConfig
Imports
java.util.ArrayList, .Collections, .List, jakarta.websocket.Decoder, .Encoder, .Extension, jakarta.websocket.server.ServerEndpointConfig

Configuration jakarta.websocket.server.ServerEndpointConfig enhanced to offer tyrus specific attributes like maxSessions. Declarative way to define maxSessions is also available using annotation MaxSessions.
Author
Ondrej Kosatka
See Also
MaxSessions

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static class
TyrusServerEndpointConfig.Builder

The TyrusServerEndpointConfig.Builder is a class used for creating TyrusServerEndpointConfig.Builder objects for the purposes of deploying a server endpoint.

Method Summary

Modifier and TypeMethod and Description
public int

Returns:

tne maximal number of open sessions.
getMaxSessions
()

Returns configured maximal number of open sessions.

Inherited from jakarta.websocket.server.ServerEndpointConfig:
getConfiguratorgetEndpointClassgetExtensionsgetPathgetSubprotocols

Method Detail

getMaxSessionsback to summary
public int getMaxSessions()

Returns configured maximal number of open sessions.

Returns:int

tne maximal number of open sessions.

org.glassfish.tyrus.core back to summary

public final Class TyrusServerEndpointConfig.Builder

extends Object
Class Inheritance

The TyrusServerEndpointConfig.Builder is a class used for creating TyrusServerEndpointConfig.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 = TyrusServerEndpointConfig.Builder.create(ProgrammaticEndpoint.class, "/foo").build();

Building a configuration with no subprotocols, limited number of sessions (100) and a custom configurator.


ServerEndpointConfig config = TyrusServerEndpointConfig.Builder.create(ProgrammaticEndpoint.class, "/bar")
        .subprotocols(subprotocols)
        .maxSessions(100)
        .configurator(new MyServerConfigurator())
        .build();
Author
dannycoward

Field Summary

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

Constructor Summary

AccessConstructor and Description
private
private
Builder(Class<?> endpointClass, String path)

Method Summary

Modifier and TypeMethod and Description
public TyrusServerEndpointConfig

Returns:

a new TyrusServerEndpointConfig object.
build
()

Builds the configuration object using the current attributes that have been set on this builder object.

public TyrusServerEndpointConfig.Builder

Returns:

this builder instance
configurator
(ServerEndpointConfig.Configurator
the configurator.
serverEndpointConfigurator
)

Sets the custom configurator to use on the configuration object built by this builder.

public static TyrusServerEndpointConfig.Builder

Returns:

a new instance of TyrusServerEndpointConfig.Builder .
create
(Class<?>
the 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 TyrusServerEndpointConfig.Builder

Returns:

this builder instance.
decoders
(List<Class<? extends Decoder>>
the decoders.
decoders
)

Sets the decoder implementation classes to use in the configuration.

public TyrusServerEndpointConfig.Builder

Returns:

this builder instance.
encoders
(List<Class<? extends Encoder>>
the encoders.
encoders
)

Sets the list of encoder implementation classes for this builder.

public TyrusServerEndpointConfig.Builder

Returns:

this builder instance.
extensions
(List<Extension>
the extensions to use.
extensions
)

Sets the extensions to use in the configuration.

public TyrusServerEndpointConfig.Builder

Returns:

this builder instance.
maxSessions
(final int
maximal number of open session.
maxSessions
)

Sets maximal number of open sessions.

public TyrusServerEndpointConfig.Builder

Returns:

this builder instance.
subprotocols
(List<String>
the subprotocols.
subprotocols
)

Sets the subprotocols to use in the configuration.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

decodersback to summary
private List<Class<? extends Decoder>> decoders
encodersback to summary
private List<Class<? extends Encoder>> encoders
endpointClassback to summary
private Class<?> endpointClass
extensionsback to summary
private List<Extension> extensions
maxSessionsback to summary
private int maxSessions
pathback to summary
private String path
serverEndpointConfiguratorback to summary
private ServerEndpointConfig.Configurator serverEndpointConfigurator
subprotocolsback to summary
private List<String> subprotocols

Constructor Detail

Builderback to summary
private Builder()
Builderback to summary
private Builder(Class<?> endpointClass, String path)

Method Detail

buildback to summary
public TyrusServerEndpointConfig build()

Builds the configuration object using the current attributes that have been set on this builder object.

Returns:TyrusServerEndpointConfig

a new TyrusServerEndpointConfig object.

configuratorback to summary
public TyrusServerEndpointConfig.Builder configurator(ServerEndpointConfig.Configurator serverEndpointConfigurator)

Sets the custom configurator to use on the configuration object built by this builder.

Parameters
serverEndpointConfigurator:ServerEndpointConfig.Configurator

the configurator.

Returns:TyrusServerEndpointConfig.Builder

this builder instance

createback to summary
public static TyrusServerEndpointConfig.Builder 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:Class<?>

the class of the endpoint to configure

path:String

The URI or URI template where the endpoint will be deployed. A trailing "/" will be ignored and the path must begin with /.

Returns:TyrusServerEndpointConfig.Builder

a new instance of TyrusServerEndpointConfig.Builder .

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

Sets the decoder implementation classes to use in the configuration.

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

the decoders.

Returns:TyrusServerEndpointConfig.Builder

this builder instance.

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

Sets the list of encoder implementation classes for this builder.

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

the encoders.

Returns:TyrusServerEndpointConfig.Builder

this builder instance.

extensionsback to summary
public TyrusServerEndpointConfig.Builder extensions(List<Extension> extensions)

Sets the extensions to use in the configuration.

Parameters
extensions:List<Extension>

the extensions to use.

Returns:TyrusServerEndpointConfig.Builder

this builder instance.

maxSessionsback to summary
public TyrusServerEndpointConfig.Builder maxSessions(final int maxSessions)

Sets maximal number of open sessions.

Parameters
maxSessions:int

maximal number of open session.

Returns:TyrusServerEndpointConfig.Builder

this builder instance.

subprotocolsback to summary
public TyrusServerEndpointConfig.Builder subprotocols(List<String> subprotocols)

Sets the subprotocols to use in the configuration.

Parameters
subprotocols:List<String>

the subprotocols.

Returns:TyrusServerEndpointConfig.Builder

this builder instance.