Class PerspectiveSessionCollection

  • All Implemented Interfaces:
    java.util.EventListener, javax.servlet.http.HttpSessionBindingListener

    public class PerspectiveSessionCollection
    extends AbstractLifecycle
    implements javax.servlet.http.HttpSessionBindingListener
    This is the top level of session object for a collection of "project" sessions. A given "auth session" (which correlates to a browser instance) can run multiple projects simultaneously because of tabbed browsing.
    • Field Detail

      • SESSION_KEY

        public static final java.lang.String SESSION_KEY
        This is the name ( "perspective-session" ) used to store this object on an HttpSession
        See Also:
        Constant Field Values
      • id

        public final java.lang.String id
        id of the parent HttpSession that owns us
      • uuid

        public final java.lang.String uuid
        UUID to help keep track of sessions by session monitor.
      • scope

        public final SessionScope scope
        "scope" of this session - Client or Designer
    • Method Detail

      • getGson

        public com.inductiveautomation.ignition.common.gson.Gson getGson()
      • getLocale

        public java.util.Locale getLocale()
        Returns the preferred Locale that the client will accept content in, based on the Accept-Language header. If the client request doesn't provide an Accept-Language header, this method returns the default locale for the server.
        Returns:
        the preferred Locale for the client
      • isValidMobile

        public boolean isValidMobile()
      • isValidWorkstation

        public boolean isValidWorkstation()
      • isBrokeredAuth

        public boolean isBrokeredAuth()
      • validate

        public void validate​(@Nullable
                             java.lang.String challengeResponse)
        Received challenge response from mobile device
      • getLocales

        public java.util.List<java.util.Locale> getLocales()
        Returns a List of Locale objects indicating, in decreasing order starting with the preferred locale, the locales that are acceptable to the client based on the Accept-Language header in the request which created this session. If the client request doesn't provide an Accept-Language header, this method returns a List containing one Locale, the default locale for the server.
        Returns:
        a List of preferred Locale objects for the client
      • getOrCreateSession

        @Nonnull
        public InternalSession getOrCreateSession​(@Nonnull
                                                  java.lang.String projectName)
        Fetch the InternalSession associated with the given project name and version or create one if it does not exist in this session collection.
        Parameters:
        projectName - the project name
        Returns:
        the InternalSession associated with the given project name and version in a running state
      • getOrCreateSession

        @Nonnull
        public InternalSession getOrCreateSession​(@Nonnull
                                                  java.lang.String projectName,
                                                  java.util.UUID sessionId)
      • findProjectSession

        @Nonnull
        public java.util.Optional<InternalSession> findProjectSession​(@Nonnull
                                                                      java.lang.String project)
      • valueBound

        public void valueBound​(javax.servlet.http.HttpSessionBindingEvent event)
        Specified by:
        valueBound in interface javax.servlet.http.HttpSessionBindingListener
      • valueUnbound

        public void valueUnbound​(javax.servlet.http.HttpSessionBindingEvent event)
        Specified by:
        valueUnbound in interface javax.servlet.http.HttpSessionBindingListener
      • onShutdown

        public void onShutdown()
        Stops any ongoing processes running as part of the project running in this session.
        Specified by:
        onShutdown in class AbstractLifecycle
      • notifyConnected

        public void notifyConnected​(MessageChannel channel)
      • notifyDisconnected

        public void notifyDisconnected​(MessageChannel channel)
      • receive

        public void receive​(MessageChannel channel,
                            java.lang.String protocol,
                            java.io.Reader payload)
      • handleLogs

        public void handleLogs​(LogMessage log)
        Called when the client has POSTed log messages back to the server.
      • getSecurityZones

        @Nonnull
        public com.google.common.collect.ImmutableCollection<java.lang.String> getSecurityZones()
      • getTotalBytesSent

        public java.math.BigInteger getTotalBytesSent()
      • getRecentBytesSent

        public java.lang.Long getRecentBytesSent()
      • setRecentBytesSent

        public void setRecentBytesSent​(java.lang.Long recentBytesSent)