Class TyrusWebSocketEngine
- java.lang.Object
-
- org.glassfish.tyrus.core.TyrusWebSocketEngine
-
- All Implemented Interfaces:
WebSocketEngine
public class TyrusWebSocketEngine extends java.lang.Object implements WebSocketEngine
WebSocketEngineimplementation, which handles server-side handshake, validation and data processing.- Author:
- Alexey Stashok, Pavel Bucek
- See Also:
TyrusWebSocket,TyrusEndpointWrapper
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classTyrusWebSocketEngine.TyrusWebSocketEngineBuilderTyrusWebSocketEnginebuilder.-
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.StringINCOMING_BUFFER_SIZEMaximum size of incoming buffer in bytes.static java.lang.StringMAX_SESSIONS_PER_APPMaximum number of open sessions per server application.static java.lang.StringMAX_SESSIONS_PER_REMOTE_ADDRMaximum number of open sessions per unique remote address.static java.lang.StringPARALLEL_BROADCAST_ENABLEDParallel broadcast support.static java.lang.StringTRACING_THRESHOLDProperty used for configuring tracing threshold.static java.lang.StringTRACING_TYPEProperty used for configuring the type of tracing supported by the server.static java.lang.StringWSADL_SUPPORTWsadl support.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static TyrusWebSocketEngine.TyrusWebSocketEngineBuilderbuilder(WebSocketContainer webSocketContainer)CreateTyrusWebSocketEngine.TyrusWebSocketEngineBuilderinstance based on passedWebSocketContainer.ApplicationEventListenergetApplicationEventListener()GetApplicationEventListenerrelated to currentTyrusWebSocketEngineinstance.ApplicationgetWsadlApplication()GetApplicationrepresenting current set of deployed endpoints.voidregister(jakarta.websocket.server.ServerEndpointConfig serverConfig, java.lang.String contextPath)RegisterServerEndpointConfig.voidregister(java.lang.Class<?> endpointClass, java.lang.String contextPath)Register endpoint class.voidsetIncomingBufferSize(int incomingBufferSize)Deprecated.Please use.TyrusWebSocketEngineBuilder#incomingBufferSize(Integer)instead.voidunregister(TyrusEndpointWrapper endpointWrapper)Un-registers the specifiedTyrusEndpointWrapperwith theWebSocketEngine.WebSocketEngine.UpgradeInfoupgrade(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
Integeror 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
Integeror 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
Integeror 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
trueorfalseand the default value isfalse.
-
-
Method Detail
-
builder
public static TyrusWebSocketEngine.TyrusWebSocketEngineBuilder builder(WebSocketContainer webSocketContainer)
CreateTyrusWebSocketEngine.TyrusWebSocketEngineBuilderinstance based on passedWebSocketContainer.- Parameters:
webSocketContainer-WebSocketContainerinstance. Cannot benull.- Returns:
- new builder.
-
upgrade
public WebSocketEngine.UpgradeInfo upgrade(UpgradeRequest request, UpgradeResponse response)
Description copied from interface:WebSocketEngineA transport calls this method to upgrade a HTTP request.- Specified by:
upgradein 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 DeploymentExceptionDescription copied from interface:WebSocketEngineRegister endpoint class.- Specified by:
registerin 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(jakarta.websocket.server.ServerEndpointConfig serverConfig, java.lang.String contextPath) throws DeploymentExceptionDescription copied from interface:WebSocketEngineRegisterServerEndpointConfig.- Specified by:
registerin 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 specifiedTyrusEndpointWrapperwith theWebSocketEngine.- Parameters:
endpointWrapper- theTyrusEndpointWrapperto un-register.
-
getApplicationEventListener
public ApplicationEventListener getApplicationEventListener()
GetApplicationEventListenerrelated to currentTyrusWebSocketEngineinstance.- Returns:
- listener instance.
-
getWsadlApplication
@Beta public Application getWsadlApplication()
GetApplicationrepresenting current set of deployed endpoints.- Returns:
- application representing current set of deployed endpoints.
-
-