Class ClientReqSession

java.lang.Object
com.inductiveautomation.ignition.gateway.clientcomm.ClientReqSession
All Implemented Interfaces:
jakarta.servlet.http.HttpSession

public abstract class ClientReqSession extends Object implements jakarta.servlet.http.HttpSession
Represents a session for a Designer or Vision Client.
  • Field Details

    • SESSION_IS_DESIGNER

      public static final String SESSION_IS_DESIGNER
      true if the session belongs to a designer.
      See Also:
    • SESSION_USERNAME

      public static final String SESSION_USERNAME
      The username (String) of the ClientReqSession.User the session belongs to.
      See Also:
    • SESSION_USER

      public static final String SESSION_USER
      The ClientReqSession.User the session belongs to.
      See Also:
    • SESSION_PROJECT_NAME

      public static final String SESSION_PROJECT_NAME
      The name (a String) of the project that this session has loaded
      See Also:
    • SESSION_REMOTE_ADDR

      public static final String SESSION_REMOTE_ADDR
      This is the address of the client, a String, as returned by ServletRequest.getRemoteAddr()
      See Also:
    • SESSION_MEM_USED

      public static final String SESSION_MEM_USED
      See Also:
    • SESSION_REMOTE_HOST

      public static final String SESSION_REMOTE_HOST
      This holds the self-reported "hostname" (a String) that the client sent when it first logged in. This is whatever:

       InetAddress.getLocalHost().getHostName()
       

      returns from the client JVM.

      See Also:
    • SESSION_TIMEZONE

      public static final String SESSION_TIMEZONE
      Holds the TimeZone that the client JVM is in
      See Also:
    • SESSION_MUTABILITY

      public static final String SESSION_MUTABILITY
      Holds the mutability mode of the session.
      See Also:
    • SESSION_TIMEOUT

      public static final int SESSION_TIMEOUT
      The session timeout length for RUNTIME sessions
    • DESIGNER_SESSION_TIMEOUT

      public static final int DESIGNER_SESSION_TIMEOUT
      The session timeout length for DESIGNER sessions
    • INITIAL_TIMEOUT

      public static final int INITIAL_TIMEOUT
      Initial timeout for all sessions to allow a long time between logging in and their first message for downloading projects over slow connections
      See Also:
  • Constructor Details

    • ClientReqSession

      public ClientReqSession()
  • Method Details

    • exists

      public static boolean exists()
      Checks if the session ThreadLocal is set in this thread
    • get

      public static ClientReqSession get()
      Get the session for the calling thread.
      Returns:
      GWSession for calling thread
    • set

      protected static void set(ClientReqSession session)
      Sets session for calling thread.
      Parameters:
      session - The session
    • unset

      protected static void unset()
      Clears the session for calling thread.
    • getLocale

      public abstract Locale getLocale()
    • addNotification

      public abstract <T> void addNotification(String moduleId, String messageType, @Nullable T message, @NotNull @NotNull PushNotificationSerializer<T> serializer)
      Adds a message to the queue that will be sent asynchronously to the attached client/designer. A serializer capable of encoding type T must be provided. If you do not need to send any actual payload with your message, use addNotification(String, String).
      Throws:
      IllegalArgumentException - if the message is not null and the serializer is null.
    • addNotification

      public abstract void addNotification(String moduleId, String messageType)
      Adds a body-less message to the queue that will be sent asynchronously to the attached client/designer. To send a message with a custom payload, use addNotification(String, String, Object, PushNotificationSerializer).
    • isDesigner

      public boolean isDesigner()
    • getScope

      public abstract int getScope()
      Returns this client's ApplicationScope, either Client or Designer
      See Also:
    • getPublicId

      public abstract String getPublicId()
      Returns a unique but irreversible hash of the true id
    • addRpcFilter

      public abstract void addRpcFilter(String name, Predicate<RpcCall> filter)
      Adds a filter to the current session. The supplied predicate must return true if a given RpcCall should be rejected.
      See Also:
    • removeRpcFilter

      public abstract void removeRpcFilter(String name)
      Removes a filter from the current session.
      See Also:
    • isValid

      public abstract boolean isValid()
    • getMutabilityMode

      @NotNull public abstract @NotNull MutabilityMode getMutabilityMode()