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.ConfiguratorA web socket util class- Since:
- 8.0.0
- Author:
- jumperchen
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classZKWebSocket.ZKPrinciple
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringCONNECTION_UUID_PARAMstatic java.lang.StringDESKTOP_ID_PARAM
-
Constructor Summary
Constructors Constructor Description ZKWebSocket()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static 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.
-
-
-
Field Detail
-
DESKTOP_ID_PARAM
public static final java.lang.String DESKTOP_ID_PARAM
- See Also:
- Constant Field Values
-
CONNECTION_UUID_PARAM
public static final java.lang.String CONNECTION_UUID_PARAM
- See Also:
- Constant Field Values
-
-
Method Detail
-
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
public static Storage getDesktopStorage(jakarta.websocket.Session wsession)
Returns a storage in desktop scope from the given websocket session.- Parameters:
wsession- websocket session- Returns:
- a storage, null if desktop not found.
-
getDesktop
public static Desktop getDesktop(jakarta.websocket.Session wsession)
Returns the desktop from the given websocket session.- Parameters:
wsession- websocket session- Returns:
- a desktop, null if desktop not found
-
-