/** * 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) { checkHasLock(); lastRequestTimestamp = timestamp; }
/** * Gets the default locale for this session. * * By default this is the preferred locale of the user using the session. In * most cases it is read from the browser defaults. * * @return the locale of this session. */ public Locale getLocale() { checkHasLock(); return locale; }
/** * Potentially checks whether this session is currently locked by the * current thread, and fails with a standard error message if not. * <p> * When production mode is enabled, the check is only done if assertions are * also enabled. This is done to avoid the small performance impact of * continuously checking the lock status. The check is always done when * production mode is not enabled. */ public void checkHasLock() { checkHasLock(SESSION_NOT_LOCKED_MESSAGE); }
/** * Gets the push connection identifier for this session. Used when * establishing a push connection with the client. * * @return the push connection identifier string */ public String getPushId() { checkHasLock(); return pushId; }
/** * 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) { checkHasLock(); lastRequestDuration = time; cumulativeRequestDuration += time; }
/** * Returns the time when the last request was serviced in this session. * * @return The time when the last request was handled, in milliseconds since * the epoch. */ public long getLastRequestTimestamp() { checkHasLock(); return lastRequestTimestamp; }
/** * Gets the configuration for this session. * * @return the deployment configuration */ public DeploymentConfiguration getConfiguration() { checkHasLock(); return configuration; }
/** * Sets the session error handler. * * @param errorHandler * the new error handler */ public void setErrorHandler(ErrorHandler errorHandler) { checkHasLock(); this.errorHandler = errorHandler; }
/** * Creates a new unique id for a UI. * * @return a unique UI id */ public int getNextUIid() { checkHasLock(); return nextUIId++; }
/** * Returns the lifecycle state of this session. * * @return the current state */ public VaadinSessionState getState() { checkHasLock(); return state; }
/** * Gets the CSRF token (aka double submit cookie) that is used to protect * against Cross Site Request Forgery attacks. * * @return the csrf token string */ public String getCsrfToken() { checkHasLock(); return csrfToken; }
/** * Get the web browser associated with this session. * * @return the web browser object */ public WebBrowser getBrowser() { checkHasLock(); return browser; }
/** * @return The total time spent servicing requests in this session, in * milliseconds. */ public long getCumulativeRequestDuration() { checkHasLock(); return cumulativeRequestDuration; }
/** * @return The time spent servicing the last request in this session, in * milliseconds. */ public long getLastRequestDuration() { checkHasLock(); return lastRequestDuration; }
/** * Gets the session's error handler. * * @return the current error handler */ public ErrorHandler getErrorHandler() { checkHasLock(); return errorHandler; }
/** * Removes a request handler from the session. * * @param handler * the request handler to remove */ public void removeRequestHandler(RequestHandler handler) { checkHasLock(); requestHandlers.remove(handler); }
public void setConfiguration(DeploymentConfiguration configuration) { checkHasLock(); if (configuration == null) { throw new IllegalArgumentException("Can not set to null"); } assert this.configuration == null : "Configuration can only be set once"; this.configuration = configuration; }
/** * 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 */ public Collection<UI> getUIs() { checkHasLock(); return Collections.unmodifiableCollection(uIs.values()); }
private void checkHasLock() { VaadinSession session = uiInternals.getSession(); if (session != null) { session.checkHasLock(); } } }
private ServerRpcHandler getRpcHandler(VaadinSession session) { session.checkHasLock(); if (rpcHandler == null) { rpcHandler = createRpcHandler(); } return rpcHandler; }