org.cometd.bayeux
Interface Session

All Known Subinterfaces:
ClientSession, LocalSession, ServerSession

public interface Session

A Bayeux Session

A bayeux session represents a connection between a bayeux client and a bayeux server. Previously this interface was called "Client", but this resulted in confusion between the various representation of the server-side elements of a "Client". Thus this entity has been renamed "Session", but for backwards compatibility with the wire protocol, it is identified by a clientID field withing the messages (see Message.getClientId()).

This interface is the common base interface for both server side and client side representations of a session. Note that on the client side a local session may have representations of both serverside and client sides for the same session.


Method Summary
 void batch(java.lang.Runnable batch)
          Run a Runnable in a batch.
 void disconnect()
          Disconnect the session
 void endBatch()
          Deprecated. use batch(Runnable)
 java.lang.Object getAttribute(java.lang.String name)
          Get a named attribute
 java.util.Set<java.lang.String> getAttributeNames()
          Get Attribute names.
 java.lang.String getId()
          The ClientId of the session.
 boolean isConnected()
           
 java.lang.Object removeAttribute(java.lang.String name)
          Remove a session attribute
 void setAttribute(java.lang.String name, java.lang.Object value)
          Set a session attribute.
 void startBatch()
          Deprecated. use batch(Runnable)
 

Method Detail

getId

java.lang.String getId()
The ClientId of the session.

This would more correctly be called a "sessionId", but for backwards compatibility with the bayeux protocol, it is a clientId that identifies a session.

Returns:
A string identifying the current session.

isConnected

boolean isConnected()
Returns:
True if the session is connected

disconnect

void disconnect()
Disconnect the session


setAttribute

void setAttribute(java.lang.String name,
                  java.lang.Object value)
Set a session attribute.

Session attributes are convenience data that allows arbitrary application data to be associated with a session.

Parameters:
name - The attribute name
value - The attribute value

getAttribute

java.lang.Object getAttribute(java.lang.String name)
Get a named attribute

Parameters:
name - The name of the attribute
Returns:
The attribute value or null if not set.

getAttributeNames

java.util.Set<java.lang.String> getAttributeNames()
Get Attribute names.

Returns:
Set of known session attribute names

removeAttribute

java.lang.Object removeAttribute(java.lang.String name)
Remove a session attribute

Parameters:
name - The name of the attribute
Returns:
the previous value of the attribute

batch

void batch(java.lang.Runnable batch)
Run a Runnable in a batch.

Parameters:
batch - the Runnable to run as a batch

endBatch

void endBatch()
Deprecated. use batch(Runnable)


startBatch

void startBatch()
Deprecated. use batch(Runnable)



Copyright © 2010 Dojo Foundation. All Rights Reserved.