Package io.goobi.viewer.websockets
Class ConfigEditorEndpoint
java.lang.Object
io.goobi.viewer.websockets.ConfigEditorEndpoint
Endpoint for unlocking files opened in
AdminConfigEditorBean when leaving a page.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidCalled when the websocket closes.voidvoidHandles three JSON message kinds:{"fileToLock":"/path"}— on (re)connect: remember the path and (re-)acquire the lock so a dropped-and-restored socket restores it.{"heartbeat":true}— renew the lease (no re-acquire); reportslostif the lease is gone.{"release":true}— on real page unload: release the lock immediately (owner-checked). In both cases the client is told whether it still holds the lock via{"lockStatus":"held"|"lost"}.voidonOpen(Session session, EndpointConfig config) Store id of http session.
-
Constructor Details
-
ConfigEditorEndpoint
public ConfigEditorEndpoint()
-
-
Method Details
-
onOpen
Store id of http session.- Parameters:
session- WebSocket session being openedconfig- endpoint configuration providing HTTP session properties
-
onMessage
Handles three JSON message kinds:{"fileToLock":"/path"}— on (re)connect: remember the path and (re-)acquire the lock so a dropped-and-restored socket restores it.{"heartbeat":true}— renew the lease (no re-acquire); reportslostif the lease is gone.{"release":true}— on real page unload: release the lock immediately (owner-checked).
{"lockStatus":"held"|"lost"}.- Parameters:
message- a json object stringsession- the websocket session, used to reply
-
onClose
Called when the websocket closes. Intentionally does NOT release the lock: an idle- or proxy-closed socket must not be treated as the user leaving. The lease expires via TTL (reaped byFileLockReaper) once heartbeats stop; an explicit close releases it throughAdminConfigEditorBean.closeCurrentFileAction().- Parameters:
session- WebSocket session being closed
-
onError
-