|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.vaadin.server.VaadinSession
public class VaadinSession
Contains everything that Vaadin needs to store for a specific user. This is
typically stored in a HttpSession or PortletSession, but
others storage mechanisms might also be used.
Everything inside a VaadinSession should be serializable to ensure
compatibility with schemes using serialization for persisting the session
data.
| Nested Class Summary | |
|---|---|
class |
VaadinSession.ApplicationError
Application error is an error message defined on the application level. |
static class |
VaadinSession.SessionStartEvent
Deprecated. might be refactored or removed before 7.0.0 |
static class |
VaadinSession.WindowAttachEvent
Deprecated. might be refactored or removed before 7.0.0 |
static interface |
VaadinSession.WindowAttachListener
Window attach listener interface. |
static class |
VaadinSession.WindowDetachEvent
Deprecated. might be refactored or removed before 7.0.0 |
static interface |
VaadinSession.WindowDetachListener
Window detach listener interface. |
| Field Summary | |
|---|---|
protected WebBrowser |
browser
|
static java.lang.String |
UI_PARAMETER
The name of the parameter that is by default used in e.g. |
| Constructor Summary | |
|---|---|
VaadinSession()
|
|
| Method Summary | ||
|---|---|---|
void |
addBootstrapListener(BootstrapListener listener)
Adds a listener that will be invoked when the bootstrap HTML is about to be generated. |
|
void |
addRequestHandler(RequestHandler handler)
Adds a request handler to this session. |
|
void |
addUIProvider(UIProvider uIProvider)
|
|
void |
close()
Deprecated. might be refactored or removed before 7.0.0 |
|
void |
closeInactiveUIs()
Deprecated. might be refactored or removed before 7.0.0 |
|
java.lang.String |
createConnectorId(ClientConnector connector)
Deprecated. might be refactored or removed before 7.0.0 |
|
UI |
createUI(WrappedRequest request)
Deprecated. might be refactored or removed before 7.0.0 |
|
protected
|
createUIInstance(WrappedRequest request,
java.lang.Class<T> uiClass)
Deprecated. might be refactored or removed before 7.0.0 |
|
AbstractCommunicationManager |
getApplicationManager()
Deprecated. might be refactored or removed before 7.0.0 |
|
|
getAttribute(java.lang.Class<T> type)
Gets a stored attribute value. |
|
java.lang.Object |
getAttribute(java.lang.String name)
Gets a stored attribute value. |
|
WebBrowser |
getBrowser()
Deprecated. might be refactored or removed before 7.0.0 |
|
DeploymentConfiguration |
getConfiguration()
Gets the configuration for this session |
|
ConverterFactory |
getConverterFactory()
Gets the ConverterFactory used to locate a suitable
Converter for fields in the session. |
|
static VaadinSession |
getCurrent()
Gets the currently used session. |
|
Terminal.ErrorListener |
getErrorHandler()
Gets the session's error handler. |
|
static VaadinSession |
getForSession(WrappedSession underlyingSession)
Deprecated. might be refactored or removed before 7.0.0 |
|
GlobalResourceHandler |
getGlobalResourceHandler(boolean createOnDemand)
Gets this session's global resource handler that takes care of serving connector resources that are not served by any single connector because e.g. |
|
protected int |
getHeartbeatTimeout()
Returns the number of seconds that must pass without a valid heartbeat or UIDL request being received from a UI before that UI is removed from the application. |
|
long |
getLastRequestTime()
|
|
java.util.Locale |
getLocale()
Gets the default locale for this session. |
|
java.util.concurrent.locks.Lock |
getLock()
Gets the lock that should be used to synchronize usage of data inside this session. |
|
java.lang.String |
getLogoutURL()
Deprecated. might be refactored or removed before 7.0.0 |
|
java.util.Collection<RequestHandler> |
getRequestHandlers()
Gets the request handlers that are registered to the session. |
|
WrappedSession |
getSession()
Gets the underlying session to which this vaadin session is currently associated. |
|
long |
getTotalSessionTime()
|
|
UI |
getUIById(int uiId)
Returns a UI with the given id. |
|
java.lang.Class<? extends UI> |
getUIClass(WrappedRequest request)
Deprecated. might be refactored or removed before 7.0.0 |
|
protected int |
getUidlRequestTimeout()
Returns the number of seconds that must pass without a valid UIDL request being received from a UI before the UI is removed from the session, even though heartbeat requests are received. |
|
UI |
getUIForRequest(WrappedRequest request)
Deprecated. might be refactored or removed before 7.0.0 |
|
UIProvider |
getUiProvider(WrappedRequest request,
java.lang.Class<?> uiClass)
Deprecated. might be refactored or removed before 7.0.0 |
|
java.util.Collection<UIProvider> |
getUIProviders()
|
|
java.util.Collection<UI> |
getUIs()
Gets all the UIs of this session. |
|
java.net.URL |
getURL()
Deprecated. might be refactored or removed before 7.0.0 |
|
boolean |
isRunning()
Deprecated. might be refactored or removed before 7.0.0 |
|
protected boolean |
isUIAlive(UI ui)
Deprecated. Might be refactored or removed before 7.0.0 |
|
void |
modifyBootstrapResponse(BootstrapResponse response)
Deprecated. might be refactored or removed before 7.0.0 |
|
void |
removeBootstrapListener(BootstrapListener listener)
Remove a bootstrap listener that was previously added. |
|
void |
removeFromSession()
Deprecated. might be refactored or removed before 7.0.0 |
|
void |
removeRequestHandler(RequestHandler handler)
Removes a request handler from the session. |
|
void |
removeUIProvider(UIProvider uIProvider)
|
|
|
setAttribute(java.lang.Class<T> type,
T value)
Stores a value in this vaadin session. |
|
void |
setAttribute(java.lang.String name,
java.lang.Object value)
Stores a value in this vaadin session. |
|
void |
setConverterFactory(ConverterFactory converterFactory)
Sets the ConverterFactory used to locate a suitable
Converter for fields in the session. |
|
static void |
setCurrent(VaadinSession session)
Sets the thread local for the current session. |
|
void |
setErrorHandler(Terminal.ErrorListener errorHandler)
Sets the session error handler. |
|
void |
setLastRequestTime(long time)
Sets the time spent servicing the last request in the session and updates the total time spent servicing requests in this session. |
|
void |
setLocale(java.util.Locale locale)
Sets the default locale for this session. |
|
void |
setLogoutURL(java.lang.String logoutURL)
Deprecated. might be refactored or removed before 7.0.0 |
|
void |
start(VaadinSession.SessionStartEvent event)
Deprecated. might be refactored or removed before 7.0.0 |
|
void |
storeInSession(WrappedSession session)
Deprecated. might be refactored or removed before 7.0.0 |
|
void |
valueBound(javax.servlet.http.HttpSessionBindingEvent arg0)
|
|
void |
valueUnbound(javax.servlet.http.HttpSessionBindingEvent event)
|
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final java.lang.String UI_PARAMETER
UI class.
protected WebBrowser browser
| Constructor Detail |
|---|
public VaadinSession()
| Method Detail |
|---|
public void valueBound(javax.servlet.http.HttpSessionBindingEvent arg0)
valueBound in interface javax.servlet.http.HttpSessionBindingListenerHttpSessionBindingListener.valueBound(HttpSessionBindingEvent)public void valueUnbound(javax.servlet.http.HttpSessionBindingEvent event)
valueUnbound in interface javax.servlet.http.HttpSessionBindingListenerHttpSessionBindingListener.valueUnbound(HttpSessionBindingEvent)@Deprecated public WebBrowser getBrowser()
public long getTotalSessionTime()
public void setLastRequestTime(long time)
time - the time spent in the last request.public long getLastRequestTime()
public WrappedSession getSession()
@Deprecated public AbstractCommunicationManager getApplicationManager()
@Deprecated public java.net.URL getURL()
This is the URL what can be entered to a browser window to start the
application. Navigating to the application URL shows the main window (
#getMainWindow()) of the application. Note that the main window
can also be shown by navigating to the window url (
com.vaadin.ui.Window#getURL()).
@Deprecated public void close()
When the session is closed, close events are fired for its UIs, its state
is removed from the underlying session, and the browser window is
redirected to the application logout url set with
setLogoutURL(String). If the logout url has not been set, the
browser window is reloaded and the application is restarted.
@Deprecated public static VaadinSession getForSession(WrappedSession underlyingSession)
underlyingSession -
@Deprecated public void removeFromSession()
@Deprecated public void storeInSession(WrappedSession session)
session - @Deprecated public void start(VaadinSession.SessionStartEvent event)
This method is called by Vaadin framework when a user navigates to the application. After this call the application corresponds to the given URL and it will return windows when asked for them. There is no need to call this method directly.
Application properties are defined by servlet configuration object
ServletConfig and they are overridden by
context-wide initialization parameters
ServletContext.
event - the application start event containing details required for
starting the application.@Deprecated public boolean isRunning()
Application starts running when its start(SessionStartEvent)
method has been called and stops when the close() is called.
true if the application is running,
false if not.public DeploymentConfiguration getConfiguration()
public java.util.Locale getLocale()
public void setLocale(java.util.Locale locale)
locale - the Locale object.@Deprecated public java.lang.String getLogoutURL()
null, the application is closed normally as defined by the
application running environment.
Desktop application just closes the application window and web-application redirects the browser to application main URL.
@Deprecated public void setLogoutURL(java.lang.String logoutURL)
null, the application is closed normally as defined by the
application running environment: Desktop application just closes the
application window and web-application redirects the browser to
application main URL.
logoutURL - the logoutURL to set.public Terminal.ErrorListener getErrorHandler()
public void setErrorHandler(Terminal.ErrorListener errorHandler)
errorHandler - public ConverterFactory getConverterFactory()
ConverterFactory used to locate a suitable
Converter for fields in the session.
See setConverterFactory(ConverterFactory) for more details
public void setConverterFactory(ConverterFactory converterFactory)
ConverterFactory used to locate a suitable
Converter for fields in the session.
The ConverterFactory is used to find a suitable converter when
binding data to a UI component and the data type does not match the UI
component type, e.g. binding a Double to a TextField (which is based on a
String).
The Converter for an individual field can be overridden using
AbstractField.setConverter(Converter) and for individual property
ids in a Table using
Table.setConverter(Object, Converter).
The converter factory must never be set to null.
converterFactory - The converter factory used in the session@Deprecated public java.lang.Class<? extends UI> getUIClass(WrappedRequest request)
request - the wrapped request for which a UI is needed
UI,
WrappedRequest.getBrowserDetails()
@Deprecated
protected <T extends UI> T createUIInstance(WrappedRequest request,
java.lang.Class<T> uiClass)
request - uiClass -
@Deprecated
public UIProvider getUiProvider(WrappedRequest request,
java.lang.Class<?> uiClass)
UIProvider that should be used for a request. The
selection can further be restricted by also requiring the UI provider to
support a specific UI class.
request - the request for which to get an UI provideruiClass - the UI class for which a provider is required, or
null to use the first UI provider supporting the
request.
UIProvider,
addUIProvider(UIProvider)public void addRequestHandler(RequestHandler handler)
Handlers are called in reverse order of addition, so the most recently added handler will be called first.
handler - the request handler to addremoveRequestHandler(RequestHandler)public void removeRequestHandler(RequestHandler handler)
handler - the request handler to removepublic java.util.Collection<RequestHandler> getRequestHandlers()
addRequestHandler(RequestHandler),
removeRequestHandler(RequestHandler)public static VaadinSession getCurrent()
InheritableThreadLocal). In other cases, (e.g. from background
threads started in some other way), the current session is not
automatically defined.
nullsetCurrent(VaadinSession)public static void setCurrent(VaadinSession session)
The application developer can also use this method to define the current session outside the normal request handling and treads started from request handling threads, e.g. when initiating custom background threads.
session - getCurrent(),
ThreadLocalpublic void addUIProvider(UIProvider uIProvider)
public void removeUIProvider(UIProvider uIProvider)
@Deprecated public UI getUIForRequest(WrappedRequest request)
UI to which a particular request belongs. If the
request originates from an existing UI, that UI is returned. In other
cases, the method attempts to create and initialize a new UI and might
throw a UIRequiresMoreInformationException if all required
information is not available.
Please note that this method can also return a newly created
UI which has not yet been initialized. You can use
#isUIInitPending(int) with the UI's id ( UI.getUIId() to
check whether the initialization is still pending.
request - the request for which a UI is desired
createUI(WrappedRequest)@Deprecated public UI createUI(WrappedRequest request)
request -
public java.util.Collection<UI> getUIs()
@Deprecated public java.lang.String createConnectorId(ClientConnector connector)
connector - A connector that has not yet been assigned an id.
public UI getUIById(int uiId)
This is meant for framework internal use.
uiId - The UI id
public void addBootstrapListener(BootstrapListener listener)
listener - the bootstrap listener to addBootstrapListener.modifyBootstrapFragment(BootstrapFragmentResponse),
BootstrapListener.modifyBootstrapPage(BootstrapPageResponse)public void removeBootstrapListener(BootstrapListener listener)
listener - the bootstrap listener to removeaddBootstrapListener(BootstrapListener)@Deprecated public void modifyBootstrapResponse(BootstrapResponse response)
BootstrapResponse:
BootstrapFragmentResponse and BootstrapPageResponse.
response - the bootstrap response event for which listeners should be
fired@Deprecated public void closeInactiveUIs()
isUIAlive(com.vaadin.ui.UI)
returns false. Close events are fired for the removed UIs.
Called by the framework at the end of every request.
UI.CloseEvent,
UI.CloseListener,
isUIAlive(UI)protected int getHeartbeatTimeout()
getUidlRequestTimeout(),
closeInactiveUIs(),
DeploymentConfiguration.getHeartbeatInterval()protected int getUidlRequestTimeout()
This timeout only has effect if cleanup of inactive UIs is enabled; otherwise heartbeat requests are enough to extend UI lifetime indefinitely.
DeploymentConfiguration.isIdleUICleanupEnabled(),
getHeartbeatTimeout(),
closeInactiveUIs()@Deprecated protected boolean isUIAlive(UI ui)
ui - The UI whose status to check
public GlobalResourceHandler getGlobalResourceHandler(boolean createOnDemand)
createOnDemand - true if a resource handler should be initialized
if there is no handler associated with this application.
false if null should be returned
if there is no registered handler.
null if
there is no handler and the createOnDemand parameter is
false.public java.util.Collection<UIProvider> getUIProviders()
public java.util.concurrent.locks.Lock getLock()
public void setAttribute(java.lang.String name,
java.lang.Object value)
null clears the stored value.
name - the name to associate the value with, can not be
nullvalue - the value to associate with the name, or null to
remove a previous association.getAttribute(String)
public <T> void setAttribute(java.lang.Class<T> type,
T value)
null clears the stored value.
The fully qualified name of the type is used as the name when storing the
value. The outcome of calling this method is thus the same as if calling
setAttribute(type.getName(), value);
type - the type that the stored value represents, can not be nullvalue - the value to associate with the type, or null to
remove a previous association.getAttribute(Class),
setAttribute(String, Object)public java.lang.Object getAttribute(java.lang.String name)
null is returned.
name - the name of the value to get, can not be null.
null if no value has been stored or if
it has been set to null.setAttribute(String, Object)public <T> T getAttribute(java.lang.Class<T> type)
null is returned.
The fully qualified name of the type is used as the name when getting the
value. The outcome of calling this method is thus the same as if calling
getAttribute(type.getName());
type - the type of the value to get, can not be null.
null if no value has been stored or if
it has been set to null.setAttribute(Class, Object),
getAttribute(String)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||