Package org.zkoss.zk.ui.http
Class ZKWebSocket
java.lang.Object
jakarta.websocket.server.ServerEndpointConfig.Configurator
org.zkoss.zk.ui.http.ZKWebSocket
public final class ZKWebSocket
extends jakarta.websocket.server.ServerEndpointConfig.Configurator
A web socket util class
- Since:
- 8.0.0
- Author:
- jumperchen
-
Nested Class Summary
Nested Classes -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic DesktopgetDesktop(jakarta.websocket.Session wsession) Returns the desktop from the given websocket session.static StoragegetDesktopStorage(jakarta.websocket.Session wsession) Returns a storage in desktop scope from the given websocket session.static voidinitZkDesktop(jakarta.websocket.Session wsession, jakarta.websocket.EndpointConfig config) Stores the zksession and desktop id into the websocket session userProperties, removes the temporary key/value from the endpoint userProperties.voidmodifyHandshake(jakarta.websocket.server.ServerEndpointConfig config, jakarta.websocket.server.HandshakeRequest request, jakarta.websocket.HandshakeResponse response) Retrieves the current zk session from handshake request and store this temporarily under a unique key ('${desktopid}|[${connection_uuid}]') inside the endpoint config userProperties.Methods inherited from class jakarta.websocket.server.ServerEndpointConfig.Configurator
checkOrigin, getEndpointInstance, getNegotiatedExtensions, getNegotiatedSubprotocol
-
Field Details
-
DESKTOP_ID_PARAM
- See Also:
-
CONNECTION_UUID_PARAM
- See Also:
-
-
Constructor Details
-
ZKWebSocket
public ZKWebSocket()
-
-
Method Details
-
modifyHandshake
public void modifyHandshake(jakarta.websocket.server.ServerEndpointConfig config, jakarta.websocket.server.HandshakeRequest request, jakarta.websocket.HandshakeResponse response) Retrieves the current zk session from handshake request and store this temporarily under a unique key ('${desktopid}|[${connection_uuid}]') inside the endpoint config userProperties. This is temp key is removed duringinitZkDesktop(Session, EndpointConfig)- Overrides:
modifyHandshakein classjakarta.websocket.server.ServerEndpointConfig.Configurator- Parameters:
config-request-response-
-
initZkDesktop
public static void initZkDesktop(jakarta.websocket.Session wsession, jakarta.websocket.EndpointConfig config) Stores the zksession and desktop id into the websocket session userProperties, removes the temporary key/value from the endpoint userProperties. After calling this method the zk desktop is available viagetDesktop(Session). This method is called during websocket endpoint onOpen. E.g.WebSocketEndPoint.onOpen(Session, EndpointConfig)- Parameters:
wsession- Websocket sessionconfig- Endpoint config- Since:
- 8.6.4
-
getDesktopStorage
Returns a storage in desktop scope from the given websocket session.- Parameters:
wsession- websocket session- Returns:
- a storage, null if desktop not found.
-
getDesktop
Returns the desktop from the given websocket session.- Parameters:
wsession- websocket session- Returns:
- a desktop, null if desktop not found
-