Interface SessionIdTracker


public interface SessionIdTracker
Interface to be implemented by the client, providing external tracking of Variant session IDs. Instead of relying on the host application's native sessions (which may not even be available), Variant server implements its own distributed session management. However, Variant server relies on the client code and the host application to provide tracking of session IDs between state requests. The concrete implementation of this interface depends on the technology stack of the host application. For example, a webapp will use an HTTP cookie to store the session ID between page visits or API calls.

By contract, an implementation must provide the constructor with the single parameter of type Object. Variant uses this constructor to instantiate a concrete implementation within the scope of Connection.getSession(Object) or Connection.getOrCreateSession(Object, Optional) methods by passing it (without interpretation) as the first parameter.

Configured with the VariantClient.Builder.withSessionIdTrackerClass(Class). There is no default implementation.

Since:
0.6
  • Method Summary

    Modifier and Type
    Method
    Description
    get()
    The current value of the session ID tracked by this object, if any.
    save(Object userData)
    Save the value of session ID tracked by this object to the underlying persistence mechanism.
    void
    set(String sessionId)
    Set the value of session ID tracked by this object.