Class TyrusWebSocketEngine
- java.lang.Object
-
- org.glassfish.tyrus.core.TyrusWebSocketEngine
-
- All Implemented Interfaces:
WebSocketEngine
public class TyrusWebSocketEngine extends java.lang.Object implements WebSocketEngine
WebSocketEngine
implementation, which handles server-side handshake, validation and data processing.- Author:
- Alexey Stashok, Pavel Bucek (pavel.bucek at oracle.com)
- See Also:
TyrusWebSocket
,TyrusEndpointWrapper
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
TyrusWebSocketEngine.TyrusWebSocketEngineBuilder
TyrusWebSocketEngine
builder.-
Nested classes/interfaces inherited from interface org.glassfish.tyrus.spi.WebSocketEngine
WebSocketEngine.UpgradeInfo, WebSocketEngine.UpgradeStatus
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
INCOMING_BUFFER_SIZE
Maximum size of incoming buffer in bytes.static java.lang.String
MAX_SESSIONS_PER_APP
Maximum number of open sessions per server application.static java.lang.String
MAX_SESSIONS_PER_REMOTE_ADDR
Maximum number of open sessions per unique remote address.static java.lang.String
PARALLEL_BROADCAST_ENABLED
Parallel broadcast support.static java.lang.String
TRACING_THRESHOLD
Property used for configuring tracing threshold.static java.lang.String
TRACING_TYPE
Property used for configuring the type of tracing supported by the server.static java.lang.String
WSADL_SUPPORT
Wsadl support.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static TyrusWebSocketEngine.TyrusWebSocketEngineBuilder
builder(WebSocketContainer webSocketContainer)
CreateTyrusWebSocketEngine.TyrusWebSocketEngineBuilder
instance based on passedWebSocketContainer
.ApplicationEventListener
getApplicationEventListener()
GetApplicationEventListener
related to currentTyrusWebSocketEngine
instance.Application
getWsadlApplication()
GetApplication
representing current set of deployed endpoints.void
register(java.lang.Class<?> endpointClass, java.lang.String contextPath)
Register endpoint class.void
register(ServerEndpointConfig serverConfig, java.lang.String contextPath)
RegisterServerEndpointConfig
.void
setIncomingBufferSize(int incomingBufferSize)
Deprecated.Please use.TyrusWebSocketEngineBuilder#incomingBufferSize(Integer)
instead.void
unregister(TyrusEndpointWrapper endpointWrapper)
Un-registers the specifiedTyrusEndpointWrapper
with theWebSocketEngine
.WebSocketEngine.UpgradeInfo
upgrade(UpgradeRequest request, UpgradeResponse response)
A transport calls this method to upgrade a HTTP request.
-
-
-
Field Detail
-
INCOMING_BUFFER_SIZE
public static final java.lang.String INCOMING_BUFFER_SIZE
Maximum size of incoming buffer in bytes.The value must be
Integer
or its primitive alternative.Default value is 4194315, which means that TyrusWebSocketEngine is by default capable of processing messages up to 4 MB.
- See Also:
- Constant Field Values
-
MAX_SESSIONS_PER_APP
public static final java.lang.String MAX_SESSIONS_PER_APP
Maximum number of open sessions per server application.The value must be positive
Integer
or its primitive alternative. Negative values and zero are ignored.The number of open sessions per application is not limited by default.
- See Also:
- Constant Field Values
-
MAX_SESSIONS_PER_REMOTE_ADDR
public static final java.lang.String MAX_SESSIONS_PER_REMOTE_ADDR
Maximum number of open sessions per unique remote address.The value must be positive
Integer
or its primitive alternative. Negative values and zero are ignored.The number of open sessions per remote address is not limited by default.
- See Also:
- Constant Field Values
-
TRACING_TYPE
public static final java.lang.String TRACING_TYPE
Property used for configuring the type of tracing supported by the server.The value is expected to be string value of
DebugContext.TracingType
.The default value is
DebugContext.TracingType.OFF
.- See Also:
- Constant Field Values
-
TRACING_THRESHOLD
public static final java.lang.String TRACING_THRESHOLD
Property used for configuring tracing threshold.The value is expected to be string value of
DebugContext.TracingThreshold
.The default value is
DebugContext.TracingThreshold.SUMMARY
.- See Also:
- Constant Field Values
-
WSADL_SUPPORT
@Beta public static final java.lang.String WSADL_SUPPORT
Wsadl support.Wsadl is experimental feature which exposes endpoint configuration in form of XML file, similarly as Wadl for REST services. Currently generated Wsadl contains only set of endpoints and their endpoint paths. Wsadl is exposed on URI ending by "application.wsadl".
The value must be string,
"true"
means that the feature is enable,"false"
that the feature is disabled.Default value is "false";
- See Also:
- Constant Field Values
-
PARALLEL_BROADCAST_ENABLED
public static final java.lang.String PARALLEL_BROADCAST_ENABLED
Parallel broadcast support.TyrusSession.broadcast(String)
and.TyrusSession#broadcast(java.nio.ByteBuffer)
operations are by default executed in parallel. The parallel execution of broadcast can be disabled by setting this server property tofalse
.Expected value is
true
orfalse
and the default value isfalse
.
-
-
Method Detail
-
builder
public static TyrusWebSocketEngine.TyrusWebSocketEngineBuilder builder(WebSocketContainer webSocketContainer)
CreateTyrusWebSocketEngine.TyrusWebSocketEngineBuilder
instance based on passedWebSocketContainer
.- Parameters:
webSocketContainer
-WebSocketContainer
instance. Cannot benull
.- Returns:
- new builder.
-
upgrade
public WebSocketEngine.UpgradeInfo upgrade(UpgradeRequest request, UpgradeResponse response)
Description copied from interface:WebSocketEngine
A transport calls this method to upgrade a HTTP request.- Specified by:
upgrade
in interfaceWebSocketEngine
- Parameters:
request
- request to be upgraded.response
- response to the upgrade request.- Returns:
- info about upgrade status and connection details.
-
setIncomingBufferSize
public void setIncomingBufferSize(int incomingBufferSize)
Deprecated.Please use.TyrusWebSocketEngineBuilder#incomingBufferSize(Integer)
instead.Set incoming buffer size.- Parameters:
incomingBufferSize
- buffer size in bytes.
-
register
public void register(java.lang.Class<?> endpointClass, java.lang.String contextPath) throws DeploymentException
Description copied from interface:WebSocketEngine
Register endpoint class.- Specified by:
register
in interfaceWebSocketEngine
- Parameters:
endpointClass
- endpoint class to be registered.contextPath
- context path of the registered endpoint.- Throws:
DeploymentException
- when the endpoint is invalid.
-
register
public void register(ServerEndpointConfig serverConfig, java.lang.String contextPath) throws DeploymentException
Description copied from interface:WebSocketEngine
RegisterServerEndpointConfig
.- Specified by:
register
in interfaceWebSocketEngine
- Parameters:
serverConfig
- server endpoint to be registered.contextPath
- context path of the registered endpoint.- Throws:
DeploymentException
- when the endpoint is invalid.
-
unregister
public void unregister(TyrusEndpointWrapper endpointWrapper)
Un-registers the specifiedTyrusEndpointWrapper
with theWebSocketEngine
.- Parameters:
endpointWrapper
- theTyrusEndpointWrapper
to un-register.
-
getApplicationEventListener
public ApplicationEventListener getApplicationEventListener()
GetApplicationEventListener
related to currentTyrusWebSocketEngine
instance.- Returns:
- listener instance.
-
getWsadlApplication
@Beta public Application getWsadlApplication()
GetApplication
representing current set of deployed endpoints.- Returns:
- application representing current set of deployed endpoints.
-
-