Package org.atmosphere.cpr
Interface AtmosphereResourceSession
-
- All Known Implementing Classes:
DefaultAtmosphereResourceSession
public interface AtmosphereResourceSessionThe AtmosphereResourceSession is managed by theAtmosphereResourceSessionFactory. It is created on demand by viaAtmosphereResourceSessionFactory.getSession(AtmosphereResource, boolean)orAtmosphereResourceSessionFactory.getSession(AtmosphereResource). It allows serverside values to be stored against anAtmosphereResourceand lives for the lifetime of theAtmosphereResource- Author:
- uklance (https://github.com/uklance)
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description java.lang.ObjectgetAttribute(java.lang.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(java.lang.String name, java.lang.Class<T> type)Returns the object bound with the specified name in this session, or null if no object is bound under the namejava.util.Collection<java.lang.String>getAttributeNames()Returns a Collection of Strings containing the names of all the objects bound to this session.voidinvalidate()Invalidates this session then unbinds any objects bound to it.java.lang.ObjectsetAttribute(java.lang.String name, java.lang.Object value)Binds an object to this session, using the name specified
-
-
-
Method Detail
-
setAttribute
java.lang.Object setAttribute(java.lang.String name, java.lang.Object value)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:
java.lang.IllegalStateException- if this method is called on an invalidated session
-
getAttribute
java.lang.Object getAttribute(java.lang.String name)
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:
java.lang.IllegalStateException- if this method is called on an invalidated session
-
getAttribute
<T> T getAttribute(java.lang.String name, java.lang.Class<T> type)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:
java.lang.IllegalStateException- if this method is called on an invalidated session
-
getAttributeNames
java.util.Collection<java.lang.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:
java.lang.IllegalStateException- if this method is called on an invalidated session
-
invalidate
void invalidate()
Invalidates this session then unbinds any objects bound to it.- Throws:
java.lang.IllegalStateException- if this method is called on an invalidated session
-
-