Eclipse Rich Ajax Platform

org.eclipse.rwt.service
Interface ISessionStore


public interface ISessionStore

The ISessionStore represents a storage place for objects with session scope. The session store itself is stored in the servlet container's session. Different than the HttpSession it is possible to register programmatically a listener that is notified before the session store will be destroyed (HttpSessionListeners don't work with RAP). This gives the possibility to cleanup on session shutdown with the session singleton infrastructure intact.

Since:
1.0

Method Summary
 boolean addSessionStoreListener(SessionStoreListener listener)
          Adds an instance of SessionStoreListener to this ISessionStore.
 java.lang.Object getAttribute(java.lang.String name)
          Returns the object bound with the specified name in this ISessionStore, or null if no object is bound under the name.
 java.util.Enumeration<java.lang.String> getAttributeNames()
          Returns an Enumeration of String objects containing the names of all the objects bound to this ISessionStore.
 HttpSession getHttpSession()
          Returns the underlying HttpSession instance.
 java.lang.String getId()
          Returns a string containing the unique identifier assigned to the underlying HttpSession.
 boolean isBound()
          Returns whether this ISessionStore is bound to the underlying HttpSession or not.
 boolean removeAttribute(java.lang.String name)
          Removes the object bound with the specified name from this ISessionStore.
 boolean removeSessionStoreListener(SessionStoreListener listener)
          Removes an instance of SessionStoreListener to this ISessionStore.
 boolean setAttribute(java.lang.String name, java.lang.Object value)
          Binds an object to this ISessionStore, using the name specified.
 

Method Detail

setAttribute

boolean setAttribute(java.lang.String name,
                     java.lang.Object value)
Binds an object to this ISessionStore, using the name specified. If an object of the same name is already bound to the ISessionStore the object is replaced.

After this method executes, and if the new object implements HttpSessionBindingListener, the ISessionStore calls HttpSessionBindingListener.valueBound.

If an object was already bound to this ISessionStore of this name that implements HttpSessionBindingListener, its HttpSessionBindingListener.valueUnbound method is called.

If the value passed in 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:
true if the attribute was set or false if the attribute could not be set because the session was invalidated.

getAttribute

java.lang.Object getAttribute(java.lang.String name)
Returns the object bound with the specified name in this ISessionStore, or null if no object is bound under the name.

Parameters:
name - a string specifying the name of the object; cannot be null
Returns:
the object with the specified name or null if the underlying session was invalidated.

removeAttribute

boolean removeAttribute(java.lang.String name)
Removes the object bound with the specified name from this ISessionStore. If no object is bound with the specified name, this method does nothing.

After this method executes, and if the object implements HttpSessionBindingListener, the HttpSessionBindingListener.valueUnbound is called.

Parameters:
name - The name of the object to remove from this ISessionStore; cannot be null
Returns:
true if the attribute was removed or false if the attribute could not be removed because the session was invalidated.
See Also:
isBound()

getAttributeNames

java.util.Enumeration<java.lang.String> getAttributeNames()
Returns an Enumeration of String objects containing the names of all the objects bound to this ISessionStore.

Returns:
An Enumeration of String objects specifying the names of all the objects bound to this ISessionStore or an empty enumeration if the underlying session was invalidated.
See Also:
isBound()

getId

java.lang.String getId()
Returns a string containing the unique identifier assigned to the underlying HttpSession. The identifier is assigned by the servlet container and is implementation dependent.

Returns:
A string specifying the identifier assigned to the underlying HttpSession.

addSessionStoreListener

boolean addSessionStoreListener(SessionStoreListener listener)
Adds an instance of SessionStoreListener to this ISessionStore. SessionStoreListeners are used to get notifications before the session store is destroyed. If the given listener is already added the method has no effect.

Parameters:
listener - the SessionStoreListener to be added
Returns:
true if the listener was added or false if the listener could not be added because the session was invalidated.
See Also:
isBound()

removeSessionStoreListener

boolean removeSessionStoreListener(SessionStoreListener listener)
Removes an instance of SessionStoreListener to this ISessionStore. SessionStoreListeners are used to get notifications before the session store is destroyed. If the given listener is not added to the session store this method has no effect.

Parameters:
listener - the SessionStoreListener to be removed
Returns:
true if the listener was removed or false if the listener could not be removed because the session was invalidated.
See Also:
isBound()

getHttpSession

HttpSession getHttpSession()
Returns the underlying HttpSession instance.

Returns:
the HttpSession instance

isBound

boolean isBound()
Returns whether this ISessionStore is bound to the underlying HttpSession or 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.

Eclipse Rich Ajax Platform

Copyright (c) EclipseSource and others 2002, 2012. All rights reserved.