Interface UISession
UISession represents the current instance of the UI.
 
 In contrast to the HttpSession it is possible to register a listener that is
 notified before the session is destroyed. This listener can be used to cleanup on
 session shutdown with the UI session still intact.
 
- Since:
- 2.0
- 
Method SummaryModifier and TypeMethodDescriptionbooleanaddUISessionListener(UISessionListener listener) Adds aUISessionListenerto this UI session.voidExecutes the given runnable in the context of this UI session.Returns the ApplicationContext this UISession belongs to.getAttribute(String name) Returns the object bound with the specified name in this UI session, ornullif no object is bound under the name.Returns anEnumerationof the names of all objects bound to this UI session.Returns a representation of the client that is connected with the server in this UI session.Returns the connection used to communicate with the client that is connected to this UI session.HttpSessionReturns the underlying HttpSession instance.getId()Returns a unique identifier for this UI session.Returns the preferredLocalefor this UI session.booleanisBound()Returns whether this UI session is bound to the underlyingHttpSessionor not.booleanremoveAttribute(String name) Removes the object bound with the specified name from this UI session.booleanremoveUISessionListener(UISessionListener listener) Removes aUISessionListenerfrom this UI session.booleansetAttribute(String name, Object value) Binds an object to this UI Session, using the name specified.voidSets the preferredLocalefor this UI session.
- 
Method Details- 
setAttributeBinds an object to this UI Session, using the name specified. If an object of the same name is already bound to the UI session, the object is replaced.If the value is null, this has the same effect as calling removeAttribute().- Parameters:
- name- the name to which the object is bound; cannot be- null
- value- the object to be bound
- Returns:
- trueif the attribute was set or- falseif the attribute could not be set because the session was invalidated.
 
- 
getAttributeReturns the object bound with the specified name in this UI session, ornullif no object is bound under the name.- Parameters:
- name- a string specifying the name of the object; cannot be null
- Returns:
- the object bound with the specified name or nullif no object is bound with this name
 
- 
removeAttributeRemoves the object bound with the specified name from this UI session. If no object is bound with the specified name, this method does nothing.- Parameters:
- name- The name of the object to remove from this UI session, must not be- null
- Returns:
- trueif the attribute was removed or- falseif the attribute could not be removed because the session was invalidated
- See Also:
 
- 
getAttributeNamesEnumeration<String> getAttributeNames()Returns anEnumerationof the names of all objects bound to this UI session.- Returns:
- An Enumerationof strings that contains the names of all objects bound to this UI session or an empty enumeration if the underlying session was invalidated
- See Also:
 
- 
getIdString getId()Returns a unique identifier for this UI session.- Returns:
- the unique identifier for this UI session
 
- 
addUISessionListenerAdds aUISessionListenerto this UI session. UISessionListeners are used to receive a notification before the UI session is destroyed. If the given listener was already added the method has no effect.If the UI session is already destroyed or is about to be destroyed the listener will not be added. In this case, this method returns false. A return value oftrueensures that the listener is registered and will be called.- Parameters:
- listener- the listener to be added
- Returns:
- trueif the listener was added and will be called, or- falseif the listener could not be added
- See Also:
 
- 
removeUISessionListenerRemoves aUISessionListenerfrom this UI session. UISessionListeners are used to receive notifications before the UI session is destroyed. If the given listener was not added to the session store this method has no effect.If the UI session is already destroyed or is about to be destroyed the listener will not be removed. In this case, this method returns false. A return value oftrueensures that the listener is removed and will not be called anymore.- Parameters:
- listener- the listener to be removed
- Returns:
- trueif the listener was removed and will not be called anymore, or- falseif the listener could not be removed
- See Also:
 
- 
getApplicationContextApplicationContext getApplicationContext()Returns the ApplicationContext this UISession belongs to.- Returns:
- the application context for this UI session
- Since:
- 2.1
 
- 
getHttpSessionHttpSession getHttpSession()Returns the underlying HttpSession instance.- Returns:
- the HttpSession instance
 
- 
isBoundboolean isBound()Returns whether this UI session is bound to the underlyingHttpSessionor not. If the session store is unbound it behaves as if the HTTP session it belonged to was invalidated.- Returns:
- true if the session store is bound, false otherwise.
 
- 
getClientClient getClient()Returns a representation of the client that is connected with the server in this UI session.- Returns:
- The client for this UI session, never null
 
- 
getConnectionConnection getConnection()Returns the connection used to communicate with the client that is connected to this UI session.- Returns:
- the connection for this UI session, never null
 
- 
getLocaleLocale getLocale()Returns the preferredLocalefor this UI session. The result reflects the locale that has been set usingsetLocale(Locale). If no locale has been set on this UISession, the locale will be taken from client using theClientInfoservice. If the client request doesn't provide a preferred locale, then this method returns the default locale for the server.- Returns:
- the preferred locale for the client, or the default system locale, never
         null
- See Also:
 
- 
setLocaleSets the preferredLocalefor this UI session. The value set can be retrieved usinggetLocale().- Parameters:
- locale- the locale to set, or- nullto reset
- See Also:
 
- 
execExecutes the given runnable in the context of this UI session. The runnable will be executed in the calling thread but with a simulated context so that calls toRWT.getUISessionwill return this UISession even in a background thread.Note: this method is discouraged. It is only kept for compatibility. New code should access the UISession directly. - Parameters:
- runnable- the runnable to execute in the context of this UI session
- See Also:
 
 
-