Interface SessionCtrl

  • All Known Implementing Classes:
    SerializableSession, SimpleSession

    public interface SessionCtrl
    Additional interface of Session for implementation.

    Note: applications shall never access this interface.

    Author:
    tomyeh
    • Method Detail

      • setDeviceType

        void setDeviceType​(java.lang.String deviceType)
        Sets the device type that this session belongs to.

        It is called by the desktop when Desktop.setDeviceType(java.lang.String) is called. Don't call this method directly. Otherwise, the result is unpredictable.

        Since:
        2.4.1
      • getDesktopCache

        DesktopCache getDesktopCache()
        Returns the desktop cache, or null if not available.

        Note: this is an utility to implement DesktopCacheProvider, which might or might not use this method. Other part of ZK shall not access this method.

      • setDesktopCache

        void setDesktopCache​(DesktopCache cache)
        Sets the desktop cache.

        Note: this is an utility to implement DesktopCacheProvider, which might or might not use this method. Other part of ZK shall not access this method.

        Parameters:
        cache - the desktop cache; null to denote no cache available.
      • onDestroyed

        void onDestroyed()
        Called when the session is destroyed.

        Application shall never access this method.

      • recover

        void recover​(java.lang.Object nativeSession)
        Called when ZK detects Session.getNativeSession() is not initialized properly.

        It is actually a workaround to solve the issue that some Web container fails to call HttpSessionActivationListener.sessionDidActivate() upon failover.

        It can be used to solve the issue that the mapping between the native session and the ZK session is changed. For example, you might manually invalidate the http session and recreate one. Then, you have to call this method to associate the ZK session with the new created session.

      • isInvalidated

        boolean isInvalidated()
        Returns whether this session is invalidated (i.e., Session.invalidate() was called).

        Note: ZK doesn't invalidate it immediately (until the event has been processed), so the session might be still alive.

      • invalidateNow

        void invalidateNow()
        Really invalidates the session.

        Application shall never access this method.

      • notifyClientRequest

        boolean notifyClientRequest​(boolean keepAlive)
        Notifies the session that a client request is received.
        Parameters:
        keepAlive - if the request will keep the session alive, or the request shall be ignored. If the request shall be ignored and the session is timeout, it will cause the session to expire (i.e., be invalidated).
        Returns:
        whether the session is invalidated (since 6.0.0)
        Since:
        3.0.0