Class PerspectiveSessionCollection

java.lang.Object
com.inductiveautomation.ignition.common.lifecycle.AbstractLifecycle
com.inductiveautomation.perspective.gateway.session.PerspectiveSessionCollection
All Implemented Interfaces:
EventListener, javax.servlet.http.HttpSessionBindingListener, javax.servlet.http.HttpSessionIdListener

public class PerspectiveSessionCollection extends AbstractLifecycle implements javax.servlet.http.HttpSessionBindingListener, javax.servlet.http.HttpSessionIdListener
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 Details

    • SESSION_KEY

      public static final String SESSION_KEY
      This is the name ( "perspective-session" ) used to store this object on an HttpSession
      See Also:
    • context

      public final PerspectiveContext context
    • uuid

      public final 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 Details

    • getRemoteHost

      public String getRemoteHost()
    • getRemoteAddr

      public String getRemoteAddr()
    • getGson

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

      public 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()
    • getDevice

      public NativeDevice getDevice()
    • validate

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

      public List<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 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 String projectName, UUID sessionId)
    • findProjectSession

      @Nonnull public Optional<InternalSession> findProjectSession(@Nonnull String project)
    • getScope

      public SessionScope getScope()
    • getContext

      public PerspectiveContext getContext()
    • 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
    • getHttpSession

      public Optional<javax.servlet.http.HttpSession> getHttpSession()
    • sessionIdChanged

      public void sessionIdChanged(javax.servlet.http.HttpSessionEvent event, String oldSessionId)
      Specified by:
      sessionIdChanged in interface javax.servlet.http.HttpSessionIdListener
    • onStartup

      protected void onStartup()
      Specified by:
      onStartup in class AbstractLifecycle
    • 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, String protocol, Reader payload)
    • handleLogs

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

      @Nonnull public static PerspectiveSessionCollection.Builder builder()
    • getSecurityZones

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

      public BigInteger getTotalBytesSent()
    • getRecentBytesSent

      public Long getRecentBytesSent()
    • setRecentBytesSent

      public void setRecentBytesSent(Long recentBytesSent)