Class PerspectiveSessionCollection
- java.lang.Object
- 
- com.inductiveautomation.ignition.common.lifecycle.AbstractLifecycle
- 
- com.inductiveautomation.perspective.gateway.session.PerspectiveSessionCollection
 
 
- 
- All Implemented Interfaces:
- java.util.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.
- 
- 
Nested Class SummaryNested Classes Modifier and Type Class Description static classPerspectiveSessionCollection.Builder
 - 
Field SummaryFields Modifier and Type Field Description PerspectiveContextcontextSessionScopescope"scope" of this session - Client or Designerstatic java.lang.StringSESSION_KEYThis is the name ( "perspective-session" ) used to store this object on an HttpSessionjava.lang.StringuuidUUID to help keep track of sessions by session monitor.
 - 
Method SummaryAll Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static PerspectiveSessionCollection.Builderbuilder()java.util.Optional<InternalSession>findProjectSession(java.lang.String project)PerspectiveContextgetContext()NativeDevicegetDevice()com.inductiveautomation.ignition.common.gson.GsongetGson()java.util.LocalegetLocale()Returns the preferredLocalethat the client will accept content in, based on the Accept-Language header.java.util.List<java.util.Locale>getLocales()Returns aListofLocaleobjects 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.InternalSessiongetOrCreateSession(java.lang.String projectName)Fetch theInternalSessionassociated with the given project name and version or create one if it does not exist in this session collection.InternalSessiongetOrCreateSession(java.lang.String projectName, java.util.UUID sessionId)java.lang.LonggetRecentBytesSent()java.lang.StringgetRemoteAddr()java.lang.StringgetRemoteHost()SessionScopegetScope()com.google.common.collect.ImmutableCollection<java.lang.String>getSecurityZones()java.math.BigIntegergetTotalBytesSent()voidhandleLogs(LogMessage log)Called when the client has POSTed log messages back to the server.booleanisBrokeredAuth()booleanisValidMobile()booleanisValidWorkstation()voidnotifyConnected(MessageChannel channel)voidnotifyDisconnected(MessageChannel channel)voidonShutdown()Stops any ongoing processes running as part of the project running in this session.protected voidonStartup()voidreceive(MessageChannel channel, java.lang.String protocol, java.io.Reader payload)voidsessionIdChanged(javax.servlet.http.HttpSessionEvent event, java.lang.String oldSessionId)voidsetRecentBytesSent(java.lang.Long recentBytesSent)voidvalidate(java.lang.String challengeResponse)Received challenge response from mobile devicevoidvalueBound(javax.servlet.http.HttpSessionBindingEvent event)voidvalueUnbound(javax.servlet.http.HttpSessionBindingEvent event)- 
Methods inherited from class com.inductiveautomation.ignition.common.lifecycle.AbstractLifecycleisRunning, shutdown, startup
 
- 
 
- 
- 
- 
Field Detail- 
SESSION_KEYpublic 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
 
 - 
contextpublic final PerspectiveContext context 
 - 
uuidpublic final java.lang.String uuid UUID to help keep track of sessions by session monitor.
 - 
scopepublic final SessionScope scope "scope" of this session - Client or Designer
 
- 
 - 
Method Detail- 
getRemoteHostpublic java.lang.String getRemoteHost() 
 - 
getRemoteAddrpublic java.lang.String getRemoteAddr() 
 - 
getGsonpublic com.inductiveautomation.ignition.common.gson.Gson getGson() 
 - 
getLocalepublic java.util.Locale getLocale() Returns the preferredLocalethat 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 Localefor the client
 
 - 
isValidMobilepublic boolean isValidMobile() 
 - 
isValidWorkstationpublic boolean isValidWorkstation() 
 - 
isBrokeredAuthpublic boolean isBrokeredAuth() 
 - 
getDevicepublic NativeDevice getDevice() 
 - 
validatepublic void validate(@Nullable java.lang.String challengeResponse)Received challenge response from mobile device
 - 
getLocalespublic java.util.List<java.util.Locale> getLocales() Returns aListofLocaleobjects 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 aListcontaining oneLocale, the default locale for the server.- Returns:
- a Listof preferredLocaleobjects for the client
 
 - 
getOrCreateSession@Nonnull public InternalSession getOrCreateSession(@Nonnull java.lang.String projectName) Fetch theInternalSessionassociated 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 InternalSessionassociated 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) 
 - 
getScopepublic SessionScope getScope() 
 - 
getContextpublic PerspectiveContext getContext() 
 - 
valueBoundpublic void valueBound(javax.servlet.http.HttpSessionBindingEvent event) - Specified by:
- valueBoundin interface- javax.servlet.http.HttpSessionBindingListener
 
 - 
valueUnboundpublic void valueUnbound(javax.servlet.http.HttpSessionBindingEvent event) - Specified by:
- valueUnboundin interface- javax.servlet.http.HttpSessionBindingListener
 
 - 
sessionIdChangedpublic void sessionIdChanged(javax.servlet.http.HttpSessionEvent event, java.lang.String oldSessionId)- Specified by:
- sessionIdChangedin interface- javax.servlet.http.HttpSessionIdListener
 
 - 
onStartupprotected void onStartup() - Specified by:
- onStartupin class- AbstractLifecycle
 
 - 
onShutdownpublic void onShutdown() Stops any ongoing processes running as part of the project running in this session.- Specified by:
- onShutdownin class- AbstractLifecycle
 
 - 
notifyConnectedpublic void notifyConnected(MessageChannel channel) 
 - 
notifyDisconnectedpublic void notifyDisconnected(MessageChannel channel) 
 - 
receivepublic void receive(MessageChannel channel, java.lang.String protocol, java.io.Reader payload) 
 - 
handleLogspublic 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<java.lang.String> getSecurityZones() 
 - 
getTotalBytesSentpublic java.math.BigInteger getTotalBytesSent() 
 - 
getRecentBytesSentpublic java.lang.Long getRecentBytesSent() 
 - 
setRecentBytesSentpublic void setRecentBytesSent(java.lang.Long recentBytesSent) 
 
- 
 
-