Class ConfigEditorEndpoint

java.lang.Object
io.goobi.viewer.websockets.ConfigEditorEndpoint

public class ConfigEditorEndpoint extends Object
Endpoint for unlocking files opened in AdminConfigEditorBean when leaving a page.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    onClose(Session session)
    Called when the websocket closes.
    void
    onError(Session session, Throwable t)
     
    void
    onMessage(String message, Session session)
    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); reports lost if 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"}.
    void
    onOpen(Session session, EndpointConfig config)
    Store id of http session.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • ConfigEditorEndpoint

      public ConfigEditorEndpoint()
  • Method Details

    • onOpen

      public void onOpen(Session session, EndpointConfig config)
      Store id of http session.
      Parameters:
      session - WebSocket session being opened
      config - endpoint configuration providing HTTP session properties
    • onMessage

      public void onMessage(String message, Session session)
      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); reports lost if 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"}.
      Parameters:
      message - a json object string
      session - the websocket session, used to reply
    • onClose

      public void onClose(Session session)
      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 by FileLockReaper) once heartbeats stop; an explicit close releases it through AdminConfigEditorBean.closeCurrentFileAction().
      Parameters:
      session - WebSocket session being closed
    • onError

      public void onError(Session session, Throwable t)