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
 Object getAttribute(String name)
          Returns the object bound with the specified name in this session, or null if no object is bound under the name
<T> T
getAttribute(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 name
 Collection<String> getAttributeNames()
          Returns a Collection of Strings containing the names of all the objects bound to this session.
 void invalidate()
          Invalidates this session then unbinds any objects bound to it.
 Object setAttribute(String name, Object value)
          Binds an object to this session, using the name specified
 

Method Detail

setAttribute

Object setAttribute(String name,
                    Object value)
Binds an object to this session, using the name specified

Parameters:
name - Attribute name
value - 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

Object getAttribute(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:
IllegalStateException - if this method is called on an invalidated session

getAttribute

<T> T getAttribute(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 name

Parameters:
name - Attribute name
type - 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


Copyright © 2014. All Rights Reserved.