Class ClientReqSession
java.lang.Object
com.inductiveautomation.ignition.gateway.clientcomm.ClientReqSession
- All Implemented Interfaces:
jakarta.servlet.http.HttpSession
Represents a session for a Designer or Vision Client.
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intThe session timeout length for DESIGNER sessionsstatic final intInitial timeout for all sessions to allow a long time between logging in and their first message for downloading projects over slow connectionsstatic final Stringtrueif the session belongs to a designer.static final Stringstatic final StringHolds the mutability mode of the session.static final StringThe name (a String) of the project that this session has loadedstatic final StringThis is the address of the client, a String, as returned byServletRequest.getRemoteAddr()static final StringThis holds the self-reported "hostname" (a String) that the client sent when it first logged in.static final intThe session timeout length for RUNTIME sessionsstatic final StringHolds theTimeZonethat the client JVM is instatic final StringTheClientReqSession.Userthe session belongs to.static final StringThe username (String) of theClientReqSession.Userthe session belongs to. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract voidaddNotification(String moduleId, String messageType) Adds a body-less message to the queue that will be sent asynchronously to the attached client/designer.abstract <T> voidaddNotification(String moduleId, String messageType, T message, @NotNull PushNotificationSerializer<T> serializer) Adds a message to the queue that will be sent asynchronously to the attached client/designer.abstract voidaddRpcFilter(String name, Predicate<RpcCall> filter) Adds a filter to the current session.static booleanexists()Checks if the session ThreadLocal is set in this threadstatic ClientReqSessionget()Get the session for the calling thread.abstract Localeabstract @NotNull MutabilityModeabstract StringReturns a unique but irreversible hash of the true idabstract intgetScope()Returns this client's ApplicationScope, either Client or Designerbooleanabstract booleanisValid()abstract voidremoveRpcFilter(String name) Removes a filter from the current session.protected static voidset(ClientReqSession session) Sets session for calling thread.protected static voidunset()Clears the session for calling thread.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface jakarta.servlet.http.HttpSession
getAttribute, getAttributeNames, getCreationTime, getId, getLastAccessedTime, getMaxInactiveInterval, getServletContext, invalidate, isNew, removeAttribute, setAttribute, setMaxInactiveInterval
-
Field Details
-
SESSION_IS_DESIGNER
trueif the session belongs to a designer.- See Also:
-
SESSION_USERNAME
The username (String) of theClientReqSession.Userthe session belongs to.- See Also:
-
SESSION_USER
TheClientReqSession.Userthe session belongs to.- See Also:
-
SESSION_PROJECT_NAME
The name (a String) of the project that this session has loaded- See Also:
-
SESSION_REMOTE_ADDR
This is the address of the client, a String, as returned byServletRequest.getRemoteAddr()- See Also:
-
SESSION_MEM_USED
- See Also:
-
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
Holds theTimeZonethat the client JVM is in- See Also:
-
SESSION_MUTABILITY
Holds the mutability mode of the session.- See Also:
-
SESSION_TIMEOUT
public static final int SESSION_TIMEOUTThe session timeout length for RUNTIME sessions -
DESIGNER_SESSION_TIMEOUT
public static final int DESIGNER_SESSION_TIMEOUTThe session timeout length for DESIGNER sessions -
INITIAL_TIMEOUT
public static final int INITIAL_TIMEOUTInitial 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
Get the session for the calling thread.- Returns:
- GWSession for calling thread
-
set
Sets session for calling thread.- Parameters:
session- The session
-
unset
protected static void unset()Clears the session for calling thread. -
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 typeTmust be provided. If you do not need to send any actual payload with your message, useaddNotification(String, String).- Throws:
IllegalArgumentException- if the message is not null and the serializer is null.
-
addNotification
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, useaddNotification(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
Returns a unique but irreversible hash of the true id -
addRpcFilter
Adds a filter to the current session. The supplied predicate must return true if a givenRpcCallshould be rejected.- See Also:
-
removeRpcFilter
Removes a filter from the current session.- See Also:
-
isValid
public abstract boolean isValid() -
getMutabilityMode
-