org.cometd.bayeux.server
Interface ServerSession

All Superinterfaces:
Session

public interface ServerSession
extends Session

Bayeux Server Session.

This interface represents the server-side of a bayeux session. The server side of a bayeux session contains the queue of messages to be delivered to the client side of the session. Messages are normally queued on a server session by being published to a channel to which the session is subscribed, however the deliver(Session, ServerMessage) and deliver(Session, String, Object, Object) methods may be used to directly queue messages to a session without publishing them to all subscribers for a channel.


Nested Class Summary
static interface ServerSession.DeQueueListener
           
static interface ServerSession.Extension
           
static interface ServerSession.MaxQueueListener
           
static interface ServerSession.MessageListener
          Queue a message listener
static interface ServerSession.RemoveListener
          Queue a message listener
static interface ServerSession.ServerSessionListener
           
 
Method Summary
 void addExtension(ServerSession.Extension extension)
          Add and extension to this session.
 void addListener(ServerSession.ServerSessionListener listener)
           
 void deliver(Session from, ServerMessage msg)
          Deliver the message to the session listeners and queue.
 void deliver(Session from, java.lang.String channel, java.lang.Object data, java.lang.Object id)
          Deliver the message to the session listeners and queue.
 void disconnect()
          Disconnect this session.
 LocalSession getLocalSession()
          Get the local session.
 java.util.Queue<ServerMessage> getQueue()
          Get the session message queue.
 boolean isLocalSession()
           
 void removeListener(ServerSession.ServerSessionListener listener)
           
 
Methods inherited from interface org.cometd.bayeux.Session
batch, endBatch, getAttribute, getAttributeNames, getId, isConnected, removeAttribute, setAttribute, startBatch
 

Method Detail

addExtension

void addExtension(ServerSession.Extension extension)
Add and extension to this session.

Parameters:
extension -

addListener

void addListener(ServerSession.ServerSessionListener listener)
Parameters:
listener -

removeListener

void removeListener(ServerSession.ServerSessionListener listener)
Parameters:
listener -

isLocalSession

boolean isLocalSession()
Returns:
True if this is a session for a local server-side client

getLocalSession

LocalSession getLocalSession()
Get the local session.

Returns:
The LocalSession or null if this is a session for a remote client.

getQueue

java.util.Queue<ServerMessage> getQueue()
Get the session message queue.

Returns:
The queue of messages awaiting delivery to the client.

deliver

void deliver(Session from,
             ServerMessage msg)
Deliver the message to the session listeners and queue.

This is different to a SessionChannel.publish(Object) call, as the message is delivered only to this client and not to all subscribers to the channel. The message should still have a channel id specified, so that the ClientSession may identify which handler the message should be delivered to.

Parameters:
from -
msg -

deliver

void deliver(Session from,
             java.lang.String channel,
             java.lang.Object data,
             java.lang.Object id)
Deliver the message to the session listeners and queue.

This is different to a SessionChannel.publish(Object) call, as the message is delivered only to this client and not to all subscribers to the channel. The message should still have a channel id specified, so that the ClientSession may identify which handler the message should be delivered to.


disconnect

void disconnect()
Disconnect this session.

Specified by:
disconnect in interface Session


Copyright © 2010 Dojo Foundation. All Rights Reserved.