Top Description Inners Methods
org.glassfish.tyrus.spi

public Interface WebSocketEngine

Imports
jakarta.websocket.DeploymentException, jakarta.websocket.server.ServerEndpointConfig

WebSocket engine is used for upgrading HTTP requests into websocket connections. A transport gets hold of the engine from the ServerContainer and upgrades HTTP handshake requests.
Author
Pavel Bucek

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static interface
WebSocketEngine.UpgradeInfo

Upgrade info that includes status for HTTP request upgrading and connection creation details.

public static enum
WebSocketEngine.UpgradeStatus

Upgrade Status for HTTP request upgrading.

Method Summary

Modifier and TypeMethod and Description
public void
register(Class<?>
endpoint class to be registered.
endpointClass
,
String
context path of the registered endpoint.
contextPath
)

Register endpoint class.

public void
register(ServerEndpointConfig
server endpoint to be registered.
serverConfig
,
String
context path of the registered endpoint.
contextPath
)

Register jakarta.websocket.server.ServerEndpointConfig.

public WebSocketEngine.UpgradeInfo

Returns:

info about upgrade status and connection details.
upgrade
(UpgradeRequest
request to be upgraded.
request
,
UpgradeResponse
response to the upgrade request.
response
)

A transport calls this method to upgrade a HTTP request.

Method Detail

registerback to summary
public void register(Class<?> endpointClass, String contextPath) throws DeploymentException

Register endpoint class.

Parameters
endpointClass:Class<?>

endpoint class to be registered.

contextPath:String

context path of the registered endpoint.

Exceptions
DeploymentException:
when the endpoint is invalid.
registerback to summary
public void register(ServerEndpointConfig serverConfig, String contextPath) throws DeploymentException

Register jakarta.websocket.server.ServerEndpointConfig.

Parameters
serverConfig:ServerEndpointConfig

server endpoint to be registered.

contextPath:String

context path of the registered endpoint.

Exceptions
DeploymentException:
when the endpoint is invalid.
upgradeback to summary
public WebSocketEngine.UpgradeInfo upgrade(UpgradeRequest request, UpgradeResponse response)

A transport calls this method to upgrade a HTTP request.

Parameters
request:UpgradeRequest

request to be upgraded.

response:UpgradeResponse

response to the upgrade request.

Returns:WebSocketEngine.UpgradeInfo

info about upgrade status and connection details.

org.glassfish.tyrus.spi back to summary

public Interface WebSocketEngine.UpgradeInfo


Upgrade info that includes status for HTTP request upgrading and connection creation details.

Method Summary

Modifier and TypeMethod and Description
public Connection

Returns:

upgraded connection if the upgrade is successful otherwise null.
createConnection
(Writer
transport writer that actually writes tyrus websocket data to underlying connection.
writer
,
Connection.CloseListener
transport listener for receiving tyrus close notifications.
closeListener
)

Creates a connection if the upgrade is successful.

public WebSocketEngine.UpgradeStatus

Returns:

status of the upgrade.
getStatus
()

Returns the status of HTTP request upgrade.

Method Detail

createConnectionback to summary
public Connection createConnection(Writer writer, Connection.CloseListener closeListener)

Creates a connection if the upgrade is successful. Tyrus would call onConnect lifecycle method on the endpoint during the invocation of this method.

Parameters
writer:Writer

transport writer that actually writes tyrus websocket data to underlying connection.

closeListener:Connection.CloseListener

transport listener for receiving tyrus close notifications.

Returns:Connection

upgraded connection if the upgrade is successful otherwise null.

getStatusback to summary
public WebSocketEngine.UpgradeStatus getStatus()

Returns the status of HTTP request upgrade.

Returns:WebSocketEngine.UpgradeStatus

status of the upgrade.

org.glassfish.tyrus.spi back to summary

public final Enum WebSocketEngine.UpgradeStatus

extends Enum<WebSocketEngine.UpgradeStatus>
Class Inheritance

Upgrade Status for HTTP request upgrading.

Field Summary

Modifier and TypeField and Description
public static final WebSocketEngine.UpgradeStatus
HANDSHAKE_FAILED

Upgrade failed due to version, extensions, origin check etc. Tyrus would set an appropriate HTTP error status code in UpgradeResponse.

public static final WebSocketEngine.UpgradeStatus
NOT_APPLICABLE

Not a WebSocketRequest or no mapping in the application.

public static final WebSocketEngine.UpgradeStatus
SUCCESS

Upgrade is successful.

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public static WebSocketEngine.UpgradeStatus
public static WebSocketEngine.UpgradeStatus[]
Inherited from java.lang.Enum:
clonecompareTodescribeConstableequalsfinalizegetDeclaringClasshashCodenameordinaltoStringvalueOf

Field Detail

HANDSHAKE_FAILEDback to summary
public static final WebSocketEngine.UpgradeStatus HANDSHAKE_FAILED

Upgrade failed due to version, extensions, origin check etc. Tyrus would set an appropriate HTTP error status code in UpgradeResponse.

NOT_APPLICABLEback to summary
public static final WebSocketEngine.UpgradeStatus NOT_APPLICABLE

Not a WebSocketRequest or no mapping in the application. This may mean that HTTP request processing should continue (in servlet container, the next filter may be called).

SUCCESSback to summary
public static final WebSocketEngine.UpgradeStatus SUCCESS

Upgrade is successful.

Constructor Detail

UpgradeStatusback to summary
private UpgradeStatus()

Method Detail

valueOfback to summary
public static WebSocketEngine.UpgradeStatus valueOf(String name)
valuesback to summary
public static WebSocketEngine.UpgradeStatus[] values()