org.cometd
Interface Bayeux

All Known Implementing Classes:
AbstractBayeux, ContinuationBayeux

public interface Bayeux

Bayeux Server Interface.

This interface represents the server side API for the Bayeux messaging protocol.

The implementation of Bayeux will be registered as a ServletContext attribute with the name "org.cometd.bayeux". This may be set prior to the context being initialized (if the instance is shared between contexts) or during context initialization.

Bayeux implementations must be thread safe and multiple threads may simultaneously call Bayeux methods.


Field Summary
static java.lang.String ADVICE_FIELD
          Field names inside Bayeux messages - advice field
static java.lang.String ATTRIBUTE
          ServletContext attribute name used to obtain the Bayeux object
static java.lang.String CHANNEL_FIELD
          Field names inside Bayeux messages - channel field
static java.lang.String CLIENT_FIELD
          Field names inside Bayeux messages - clientId field
static java.lang.String CONNECTION_TYPE_FIELD
          Field names inside Bayeux messages - connectionType field
static java.lang.String DATA_FIELD
          Field names inside Bayeux messages - data field
static java.lang.String ERROR_FIELD
          Field names inside Bayeux messages - error field
static java.lang.String EXT_FIELD
          Field names inside Bayeux messages - ext field
static java.lang.String HANDSHAKE_RESPONSE
          Field values inside Bayeux messages - handshake response
static java.lang.String ID_FIELD
          Field names inside Bayeux messages - id field
static java.lang.String INTERVAL_FIELD
          Field names inside Bayeux messages - interval field
static java.lang.String JSON_COMMENT_FILTERED_FIELD
          Field names inside Bayeux messages - json-comment-filtered field
static java.lang.String JSON_CONTENT_TYPE
          http helpers - application/json content type
static java.lang.String JSONP_DEFAULT_NAME
          http helpers - default name of the jsonp callback function
static java.lang.String JSONP_PARAMETER
          http helpers - name of the jsonp parameter
static java.lang.String MESSAGE_PARAMETER
          http helpers - parameter name for json message
static java.lang.String META
          Meta definitions for channels
static java.lang.String META_CLIENT
          Meta definitions for channels - client messsage
static java.lang.String META_CONNECT
          Meta definitions for channels - connect message
static java.lang.String META_DISCONNECT
          Meta definitions for channels - disconnect messsage
static java.lang.String META_HANDSHAKE
          Meta definitions for channels - handshake messsage
static java.lang.String META_PING
          Meta definitions for channels - ping messsage
static java.lang.String META_SLASH
          Meta definitions for channels
static java.lang.String META_STATUS
          Meta definitions for channels - status messsage
static java.lang.String META_SUBSCRIBE
          Meta definitions for channels - subscribe messsage
static java.lang.String META_UNSUBSCRIBE
          Meta definitions for channels - unsubscribe messsage
static java.lang.String MIN_VERSION_FIELD
          Field names inside Bayeux messages - minimumVersion field
static java.lang.String NONE_RESPONSE
          Field values inside Bayeux messages - none response
static java.lang.String RECONNECT_FIELD
          Field names inside Bayeux messages - reconnect field
static java.lang.String RETRY_RESPONSE
          Field values inside Bayeux messages - retry response
static java.lang.String SERVICE
          Service channel names-starts with
static java.lang.String SERVICE_SLASH
          Service channel names-trailing slash
static java.lang.String SUBSCRIPTION_FIELD
          Field names inside Bayeux messages - subscription field
static java.lang.String SUCCESSFUL_FIELD
          Field names inside Bayeux messages - successful field
static java.lang.String SUPPORTED_CONNECTION_TYPES_FIELD
          Field names inside Bayeux messages - supportedConnectionTypes field
static java.lang.String TIMESTAMP_FIELD
          Field names inside Bayeux messages - timestamp field
static java.lang.String TRANSPORT_CALLBACK_POLL
          Transport types - callback polling
static java.lang.String TRANSPORT_FIELD
          Field names inside Bayeux messages - transport field
static java.lang.String TRANSPORT_FLASH
          Transport types - flash
static java.lang.String TRANSPORT_IFRAME
          Transport types - iframe
static java.lang.String TRANSPORT_LONG_POLL
          Transport types - long polling
static java.lang.String VERSION_FIELD
          Field names inside Bayeux messages - version field
 
Method Summary
 void addExtension(Extension ext)
          Adds a bayeux extension.
 void addListener(BayeuxListener listener)
          Adds a bayeux listener,
 Channel getChannel(java.lang.String channelId, boolean create)
          Get a Channel instance by ID.
 java.util.Collection<Channel> getChannels()
          Get all known channels.
 Client getClient(java.lang.String clientId)
          Get Client by ID.
 java.util.Collection<Client> getClients()
          Get a collection of all Clients.
 javax.servlet.http.HttpServletRequest getCurrentRequest()
          Get the current Servlet Request.
 int getMaxClientQueue()
           
 SecurityPolicy getSecurityPolicy()
          Get the SecurityPolicy instance.
 boolean hasChannel(java.lang.String channel)
          Check if channel exists.
 boolean hasClient(java.lang.String clientId)
           
 Client newClient(java.lang.String idprefix)
          Create a new server side Client.
 Channel removeChannel(java.lang.String channel)
           
 Client removeClient(java.lang.String clientId)
           
 void removeExtension(Extension ext)
          Removes a bayeux extension.
 void removeListener(BayeuxListener listener)
          Removes a bayeux listener
 void setMaxClientQueue(int size)
           
 void setSecurityPolicy(SecurityPolicy securityPolicy)
          Set the security policy for the Bayeux instance.
 

Field Detail

ATTRIBUTE

static final java.lang.String ATTRIBUTE
ServletContext attribute name used to obtain the Bayeux object

See Also:
Constant Field Values

META

static final java.lang.String META
Meta definitions for channels

See Also:
Constant Field Values

META_SLASH

static final java.lang.String META_SLASH
Meta definitions for channels

See Also:
Constant Field Values

META_CONNECT

static final java.lang.String META_CONNECT
Meta definitions for channels - connect message

See Also:
Constant Field Values

META_CLIENT

static final java.lang.String META_CLIENT
Meta definitions for channels - client messsage

See Also:
Constant Field Values

META_DISCONNECT

static final java.lang.String META_DISCONNECT
Meta definitions for channels - disconnect messsage

See Also:
Constant Field Values

META_HANDSHAKE

static final java.lang.String META_HANDSHAKE
Meta definitions for channels - handshake messsage

See Also:
Constant Field Values

META_PING

static final java.lang.String META_PING
Meta definitions for channels - ping messsage

See Also:
Constant Field Values

META_STATUS

static final java.lang.String META_STATUS
Meta definitions for channels - status messsage

See Also:
Constant Field Values

META_SUBSCRIBE

static final java.lang.String META_SUBSCRIBE
Meta definitions for channels - subscribe messsage

See Also:
Constant Field Values

META_UNSUBSCRIBE

static final java.lang.String META_UNSUBSCRIBE
Meta definitions for channels - unsubscribe messsage

See Also:
Constant Field Values

CLIENT_FIELD

static final java.lang.String CLIENT_FIELD
Field names inside Bayeux messages - clientId field

See Also:
Constant Field Values

DATA_FIELD

static final java.lang.String DATA_FIELD
Field names inside Bayeux messages - data field

See Also:
Constant Field Values

CHANNEL_FIELD

static final java.lang.String CHANNEL_FIELD
Field names inside Bayeux messages - channel field

See Also:
Constant Field Values

ID_FIELD

static final java.lang.String ID_FIELD
Field names inside Bayeux messages - id field

See Also:
Constant Field Values

ERROR_FIELD

static final java.lang.String ERROR_FIELD
Field names inside Bayeux messages - error field

See Also:
Constant Field Values

TIMESTAMP_FIELD

static final java.lang.String TIMESTAMP_FIELD
Field names inside Bayeux messages - timestamp field

See Also:
Constant Field Values

TRANSPORT_FIELD

static final java.lang.String TRANSPORT_FIELD
Field names inside Bayeux messages - transport field

See Also:
Constant Field Values

ADVICE_FIELD

static final java.lang.String ADVICE_FIELD
Field names inside Bayeux messages - advice field

See Also:
Constant Field Values

SUCCESSFUL_FIELD

static final java.lang.String SUCCESSFUL_FIELD
Field names inside Bayeux messages - successful field

See Also:
Constant Field Values

SUBSCRIPTION_FIELD

static final java.lang.String SUBSCRIPTION_FIELD
Field names inside Bayeux messages - subscription field

See Also:
Constant Field Values

EXT_FIELD

static final java.lang.String EXT_FIELD
Field names inside Bayeux messages - ext field

See Also:
Constant Field Values

CONNECTION_TYPE_FIELD

static final java.lang.String CONNECTION_TYPE_FIELD
Field names inside Bayeux messages - connectionType field

See Also:
Constant Field Values

VERSION_FIELD

static final java.lang.String VERSION_FIELD
Field names inside Bayeux messages - version field

See Also:
Constant Field Values

MIN_VERSION_FIELD

static final java.lang.String MIN_VERSION_FIELD
Field names inside Bayeux messages - minimumVersion field

See Also:
Constant Field Values

SUPPORTED_CONNECTION_TYPES_FIELD

static final java.lang.String SUPPORTED_CONNECTION_TYPES_FIELD
Field names inside Bayeux messages - supportedConnectionTypes field

See Also:
Constant Field Values

JSON_COMMENT_FILTERED_FIELD

static final java.lang.String JSON_COMMENT_FILTERED_FIELD
Field names inside Bayeux messages - json-comment-filtered field

See Also:
Constant Field Values

RECONNECT_FIELD

static final java.lang.String RECONNECT_FIELD
Field names inside Bayeux messages - reconnect field

See Also:
Constant Field Values

INTERVAL_FIELD

static final java.lang.String INTERVAL_FIELD
Field names inside Bayeux messages - interval field

See Also:
Constant Field Values

RETRY_RESPONSE

static final java.lang.String RETRY_RESPONSE
Field values inside Bayeux messages - retry response

See Also:
Constant Field Values

HANDSHAKE_RESPONSE

static final java.lang.String HANDSHAKE_RESPONSE
Field values inside Bayeux messages - handshake response

See Also:
Constant Field Values

NONE_RESPONSE

static final java.lang.String NONE_RESPONSE
Field values inside Bayeux messages - none response

See Also:
Constant Field Values

SERVICE

static final java.lang.String SERVICE
Service channel names-starts with

See Also:
Constant Field Values

SERVICE_SLASH

static final java.lang.String SERVICE_SLASH
Service channel names-trailing slash

See Also:
Constant Field Values

TRANSPORT_LONG_POLL

static final java.lang.String TRANSPORT_LONG_POLL
Transport types - long polling

See Also:
Constant Field Values

TRANSPORT_CALLBACK_POLL

static final java.lang.String TRANSPORT_CALLBACK_POLL
Transport types - callback polling

See Also:
Constant Field Values

TRANSPORT_IFRAME

static final java.lang.String TRANSPORT_IFRAME
Transport types - iframe

See Also:
Constant Field Values

TRANSPORT_FLASH

static final java.lang.String TRANSPORT_FLASH
Transport types - flash

See Also:
Constant Field Values

JSON_CONTENT_TYPE

static final java.lang.String JSON_CONTENT_TYPE
http helpers - application/json content type

See Also:
Constant Field Values

MESSAGE_PARAMETER

static final java.lang.String MESSAGE_PARAMETER
http helpers - parameter name for json message

See Also:
Constant Field Values

JSONP_PARAMETER

static final java.lang.String JSONP_PARAMETER
http helpers - name of the jsonp parameter

See Also:
Constant Field Values

JSONP_DEFAULT_NAME

static final java.lang.String JSONP_DEFAULT_NAME
http helpers - default name of the jsonp callback function

See Also:
Constant Field Values
Method Detail

getChannel

Channel getChannel(java.lang.String channelId,
                   boolean create)
Get a Channel instance by ID.

Parameters:
channelId - The Channel ID
create - If true, a channel will be created if it does not exist.
Returns:
A Channel instance or null if it does not exist and create is false.

hasChannel

boolean hasChannel(java.lang.String channel)
Check if channel exists.

Parameters:
channel -
Returns:
True if Bayeux has a channel with the channel name.

removeChannel

Channel removeChannel(java.lang.String channel)

getChannels

java.util.Collection<Channel> getChannels()
Get all known channels.

Returns:
A collection of all known channel instances.

getClient

Client getClient(java.lang.String clientId)
Get Client by ID.

Parameters:
clientId -
Returns:
A Client instance or null if the ID is not known

hasClient

boolean hasClient(java.lang.String clientId)

newClient

Client newClient(java.lang.String idprefix)
Create a new server side Client. Server side clients can be used to interact with Bayeux with publish and subscribe messaging.

Parameters:
idprefix - An identifier to prefix to the client ID.
Returns:
A Client instance with Client.isLocal() returning true.

removeClient

Client removeClient(java.lang.String clientId)

getClients

java.util.Collection<Client> getClients()
Get a collection of all Clients. The collection is copy of the underlying collection.

Returns:
Collection of clients.

getSecurityPolicy

SecurityPolicy getSecurityPolicy()
Get the SecurityPolicy instance.

Returns:
The current SecurityPolicy instance.

setSecurityPolicy

void setSecurityPolicy(SecurityPolicy securityPolicy)
Set the security policy for the Bayeux instance.

The Security Policy will be called to check access for all handshakes, subscriptions and publishing.

Parameters:
securityPolicy - The security policy instance.

addExtension

void addExtension(Extension ext)
Adds a bayeux extension. A bayeux extension may modify a message or return a new message.

Parameters:
ext - the extension to add
See Also:
removeExtension(Extension)

removeExtension

void removeExtension(Extension ext)
Removes a bayeux extension.

Parameters:
ext - the extension to remove
See Also:
addExtension(Extension)

addListener

void addListener(BayeuxListener listener)
Adds a bayeux listener,

Parameters:
listener - the listener to add
See Also:
removeListener(BayeuxListener)

removeListener

void removeListener(BayeuxListener listener)
Removes a bayeux listener

Parameters:
listener - the listener to remove
See Also:
addListener(BayeuxListener)

getMaxClientQueue

int getMaxClientQueue()
Returns:
the max client queue size
See Also:
setMaxClientQueue(int)

setMaxClientQueue

void setMaxClientQueue(int size)
Parameters:
size - The size which if a client queue exceeds, forces a call to QueueListener#queueMaxed(Client, Message) to check if the message should be added. If set to -1, there is no queue limit. If set to zero, messages are not queued unless a QueueListener is applied that returns true.
See Also:
getMaxClientQueue()

getCurrentRequest

javax.servlet.http.HttpServletRequest getCurrentRequest()
Get the current Servlet Request. If the calling thread is in the context of a servlet call, then return the request object. This can be used to authenticate users and/or perform other validation of the caller.

Returns:
A servlet request or null if none in scope.


Copyright © 2011 Dojo Foundation. All Rights Reserved.