Package org.atmosphere.cpr
Interface AtmosphereResourceSession
- All Known Implementing Classes:
DefaultAtmosphereResourceSession
public interface AtmosphereResourceSession
The AtmosphereResourceSession is managed by the
AtmosphereResourceSessionFactory. It is created on demand by via
AtmosphereResourceSessionFactory.getSession(AtmosphereResource, boolean)
or AtmosphereResourceSessionFactory.getSession(AtmosphereResource).
It allows serverside values to be stored against an
AtmosphereResource and lives for the lifetime of the
AtmosphereResource- Author:
- uklance (https://github.com/uklance)
-
Method Summary
Modifier and TypeMethodDescriptiongetAttribute(String name) Returns the object bound with the specified name in this session, or null if no object is bound under the name<T> TgetAttribute(String name, Class<T> type) Returns the object bound with the specified name in this session, or null if no object is bound under the nameReturns a Collection of Strings containing the names of all the objects bound to this session.voidInvalidates this session then unbinds any objects bound to it.setAttribute(String name, Object value) Binds an object to this session, using the name specified
-
Method Details
-
setAttribute
Binds an object to this session, using the name specified- Parameters:
name- Attribute namevalue- Attribute value- Returns:
- the previous value associated with name, or null if there was no mapping for name
- Throws:
IllegalStateException- if this method is called on an invalidated session
-
getAttribute
Returns the object bound with the specified name in this session, or null if no object is bound under the name- Parameters:
name- Attribute name- Returns:
- the object with the specified name
- Throws:
IllegalStateException- if this method is called on an invalidated session
-
getAttribute
Returns the object bound with the specified name in this session, or null if no object is bound under the name- Parameters:
name- Attribute nametype- Attribute type- Returns:
- the object with the specified name
- Throws:
IllegalStateException- if this method is called on an invalidated session
-
getAttributeNames
Collection<String> getAttributeNames()Returns a Collection of Strings containing the names of all the objects bound to this session.- Returns:
- a Collection of Strings containing the names of all the objects bound to this session
- Throws:
IllegalStateException- if this method is called on an invalidated session
-
invalidate
void invalidate()Invalidates this session then unbinds any objects bound to it.- Throws:
IllegalStateException- if this method is called on an invalidated session
-