/** * Sets the time spent servicing the last request in the session and updates * the total time spent servicing requests in this session. * * @param time * The time spent in the last request, in milliseconds. */ public void setLastRequestDuration(long time) { assert hasLock(); lastRequestDuration = time; cumulativeRequestDuration += time; }
/** * @return The time spent servicing the last request in this session, in * milliseconds. */ public long getLastRequestDuration() { assert hasLock(); return lastRequestDuration; }
/** * Gets the CSRF token (aka double submit cookie) that is used to protect * against Cross Site Request Forgery attacks. * * @since 7.1 * @return the csrf token string */ public String getCsrfToken() { assert hasLock(); return csrfToken; }
/** * @return The total time spent servicing requests in this session, in * milliseconds. */ public long getCumulativeRequestDuration() { assert hasLock(); return cumulativeRequestDuration; }
/** * Sets the time when the last UIDL request was serviced in this session. * * @param timestamp * The time when the last request was handled, in milliseconds * since the epoch. * */ public void setLastRequestTimestamp(long timestamp) { assert hasLock(); lastRequestTimestamp = timestamp; }
/** * Gets the push connection identifier for this session. Used when * establishing a push connection with the client. * * @return the push connection identifier string * * @since 8.0.6 */ public String getPushId() { assert hasLock(); return pushId; }
/** * Creates a new unique id for a UI. * * @return a unique UI id */ public int getNextUIid() { assert hasLock(); return nextUIId++; }
/** * Returns the lifecycle state of this session. * * @since 7.2 * @return the current state */ public State getState() { assert hasLock(); return state; }
/** * Gets the configuration for this session. * * @return the deployment configuration */ public DeploymentConfiguration getConfiguration() { assert hasLock(); return configuration; }
/** * @return * * @deprecated As of 7.0. Will likely change or be removed in a future * version */ @Deprecated public LegacyCommunicationManager getCommunicationManager() { assert hasLock(); return communicationManager; }
/** * Removes a request handler from the session. * * @param handler * the request handler to remove * * @since 7.0 */ public void removeRequestHandler(RequestHandler handler) { assert hasLock(); requestHandlers.remove(handler); }
public void setCommunicationManager( LegacyCommunicationManager communicationManager) { assert hasLock(); if (communicationManager == null) { throw new IllegalArgumentException("Can not set to null"); } assert this.communicationManager == null : "Communication manager can only be set once"; this.communicationManager = communicationManager; }
public void setConfiguration(DeploymentConfiguration configuration) { assert hasLock(); if (configuration == null) { throw new IllegalArgumentException("Can not set to null"); } assert this.configuration == null : "Configuration can only be set once"; this.configuration = configuration; }
/** * Removes a UI provider association from this session. * * @param uiProvider * the UI provider that should be removed */ public void removeUIProvider(UIProvider uiProvider) { assert hasLock(); uiProviders.remove(uiProvider); }
/** * Gets the UI providers configured for this session. * * @return an unmodifiable list of UI providers */ public List<UIProvider> getUIProviders() { assert hasLock(); return Collections.unmodifiableList(uiProviders); }
/** * Get the web browser associated with this session. * * @return the web browser object * * @deprecated As of 7.0, use {@link Page#getWebBrowser()} instead. */ @Deprecated public WebBrowser getBrowser() { assert hasLock(); return browser; }
/** * Adds a UI provider to this session. * * @param uiProvider * the UI provider that should be added */ public void addUIProvider(UIProvider uiProvider) { assert hasLock(); uiProviders.addFirst(uiProvider); }
/** * Gets all the UIs of this session. This includes UIs that have been * requested but not yet initialized. UIs that receive no heartbeat requests * from the client are eventually removed from the session. * * @return a collection of UIs belonging to this application * * @since 7.0 */ public Collection<UI> getUIs() { assert hasLock(); return Collections.unmodifiableCollection(uIs.values()); }
/** * Called when the VaadinSession should be removed from the underlying HTTP * session. * * @since 7.6 * @param wrappedSession * the underlying HTTP session */ public void removeSession(WrappedSession wrappedSession) { assert VaadinSession.hasLock(this, wrappedSession); removeFromHttpSession(wrappedSession); }
@Override public void markAsDirty() { assert getSession() == null || getSession().hasLock() : buildLockAssertMessage( "markAsDirty()"); UI uI = getUI(); if (uI != null) { uI.getConnectorTracker().markDirty(this); } }