Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.mortbay.cometd
Class AbstractBayeux

    java.lang.Object
      org.mortbay.cometd.AbstractBayeux

All Implemented Interfaces:
  Bayeux

    public abstract class AbstractBayeux

extends Object
implements Bayeux

Author:
  gregw, aabeling: added JSONP transport

Field Summary
`static ChannelId` | `META_CONNECT_ID`
`static ChannelId` | `META_DISCONNECT_ID`
`static ChannelId` | `META_HANDSHAKE_ID`
`static ChannelId` | `META_PING_ID`
`static ChannelId` | `META_RECONNECT_ID`
`static ChannelId` | `META_STATUS_ID`
`static ChannelId` | `META_SUBSCRIBE_ID`
`static ChannelId` | `META_UNSUBSCRIBE_ID`
`static JSON.Literal` | `TRANSPORTS`

Fields inherited from interface dojox.cometd.Bayeux
`ADVICE_FIELD, CHANNEL_FIELD, CLIENT_FIELD, DATA_FIELD, DOJOX_COMETD_BAYEUX, EXT_FIELD, ID_FIELD, META, META_CONNECT, META_DISCONNECT, META_HANDSHAKE, META_PING, META_RECONNECT, META_STATUS, META_SUBSCRIBE, META_UNSUBSCRIBE, SUBSCRIPTION_FIELD, SUCCESSFUL_FIELD, TIMESTAMP_FIELD, TRANSPORT_FIELD`

Constructor Summary
`protected` | `AbstractBayeux()`

Method Summary
`void` | `addFilter(String channels, DataFilter filter)`
`Object` | `getAdvice()`
`boolean` | `getAlwaysResumePoll()`
`ChannelImpl` | `getChannel(ChannelId id)`
`ChannelImpl` | `getChannel(String id)`
`Channel` | `getChannel(String id, boolean create)`
`ChannelId` | `getChannelId(String id)`
`Client` | `getClient(String client_id)`
`Set` | `getClientIDs()`
`long` | `getClientTimeoutMs()`
`int` | `getLogLevel()`
`int` | `getMultiFrameInterval()`
`protected long` | `getRandom(long variation)`
`SecurityPolicy` | `getSecurityPolicy()`
`String` | `handle(ClientImpl client, Transport transport, Map<String,Object> message)` Handle a Bayeux message.
`boolean` | `hasChannel(String id)`
`protected void` | `initialize(ServletContext context)`
`boolean` | `isInitialized()`
`boolean` | `isJSONCommented()`
`boolean` | `isLogDebug()`
`boolean` | `isLogInfo()`
`void` | `logDebug(String message)`
`void` | `logDebug(String message, Throwable th)`
`void` | `logInfo(String message)`
`Client` | `newClient(String idPrefix, Listener listener)`
`abstract ClientImpl` | `newRemoteClient()`
`Transport` | `newTransport(ClientImpl client, Map message)` Create new transport object for a bayeux message
`void` | `publish(ChannelId to, Client from, Object data, String msgId)`
`void` | `publish(Client fromClient, String toChannelId, Object data, String msgId)` Deliver data to a channel.
`boolean` | `removeChannel(ChannelId channelId)`
`void` | `removeFilter(String channels, DataFilter filter)`
`void` | `setAdvice(Object advice)`
`void` | `setAlwaysResumePoll(boolean always)`
`void` | `setClientTimeoutMs(long ms)`
`void` | `setJSONCommented(boolean commented)`
`void` | `setLogLevel(int logLevel)`
`void` | `setMultiFrameInterval(int multiFrameInterval)` The time a client should delay between reconnects when multiple connections from the same browser are detected.
`void` | `setSecurityPolicy(SecurityPolicy securityPolicy)`
`void` | `subscribe(String toChannel, Client subscriber)` Subscribe to a channel.
`void` | `unsubscribe(String toChannel, Client subscriber)` Unsubscribe to a channel

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### META_CONNECT_ID

    public static final ChannelId META_CONNECT_ID

### META_DISCONNECT_ID

    public static final ChannelId META_DISCONNECT_ID

### META_HANDSHAKE_ID

    public static final ChannelId META_HANDSHAKE_ID

### META_PING_ID

    public static final ChannelId META_PING_ID

### META_RECONNECT_ID

    public static final ChannelId META_RECONNECT_ID

### META_STATUS_ID

    public static final ChannelId META_STATUS_ID

### META_SUBSCRIBE_ID

    public static final ChannelId META_SUBSCRIBE_ID

### META_UNSUBSCRIBE_ID

    public static final ChannelId META_UNSUBSCRIBE_ID

### TRANSPORTS

    public static final JSON.Literal TRANSPORTS

Constructor Detail

### AbstractBayeux

    protected AbstractBayeux()

Parameters:
  `context.` - The logLevel init parameter is used to set the logging to 0=none, 1=info, 2=debug

Method Detail

### addFilter

    public void addFilter(String channels,
                          DataFilter filter)

  Specified by:
    `addFilter` in interface `Bayeux`
  Parameters:
    `channels` - A `ChannelId`
    `filter` - The filter instance to apply to new channels matching the pattern

### removeFilter

    public void removeFilter(String channels,
                             DataFilter filter)

  Specified by:
    `removeFilter` in interface `Bayeux`

### getChannel

    public ChannelImpl getChannel(ChannelId id)

  Parameters:
    `id` -
  Returns:

### getChannel

    public ChannelImpl getChannel(String id)

### getChannel

    public Channel getChannel(String id,
                              boolean create)

  Specified by:
    `getChannel` in interface `Bayeux`

### getChannelId

    public ChannelId getChannelId(String id)

### getClient

    public Client getClient(String client_id)

  Specified by:
    `getClient` in interface `Bayeux`
  Returns:

### getClientIDs

    public Set getClientIDs()

### getClientTimeoutMs

    public long getClientTimeoutMs()

### getLogLevel

    public int getLogLevel()

  Returns:
    the logLevel. 0=none, 1=info, 2=debug

### getSecurityPolicy

    public SecurityPolicy getSecurityPolicy()

  Specified by:
    `getSecurityPolicy` in interface `Bayeux`

### handle

    public String handle(ClientImpl client,
                         Transport transport,
                         Map<String,Object> message)
                  throws IOException

  Handle a Bayeux message. This is normally only called by the bayeux servlet or a test harness.

  Parameters:
    `client` - The client if known
    `transport` - The transport to use for the message
    `message` - The bayeux message.
  Throws:
    `IOException`

### hasChannel

    public boolean hasChannel(String id)

  Specified by:
    `hasChannel` in interface `Bayeux`

### isInitialized

    public boolean isInitialized()

### isJSONCommented

    public boolean isJSONCommented()

  Returns:
    the commented

### isLogDebug

    public boolean isLogDebug()

### isLogInfo

    public boolean isLogInfo()

### logDebug

    public void logDebug(String message)

### logDebug

    public void logDebug(String message,
                         Throwable th)

### logInfo

    public void logInfo(String message)

### newClient

    public Client newClient(String idPrefix,
                            Listener listener)

  Specified by:
    `newClient` in interface `Bayeux`
  Returns:

### newRemoteClient

    public abstract ClientImpl newRemoteClient()

### newTransport

    public Transport newTransport(ClientImpl client,
                                  Map message)

  Create new transport object for a bayeux message

  Parameters:
    `client` - The client
    `message` - the bayeux message
  Returns:
    the negotiated transport.

### publish

    public void publish(ChannelId to,
                        Client from,
                        Object data,
                        String msgId)

### publish

    public void publish(Client fromClient,
                        String toChannelId,
                        Object data,
                        String msgId)

  Description copied from interface: `Bayeux`
  Deliver data to a channel.

  Specified by:
    `publish` in interface `Bayeux`
  Parameters:
    `fromClient` - The client sending the data
    `toChannelId` - The Channel ID to which the data is targetted
    `data` - The data itself which must be an Object that can be encoded with `JSON`.
    `msgId` - optional message ID or null for automatic generation of a message ID.

### removeChannel

    public boolean removeChannel(ChannelId channelId)

### setClientTimeoutMs

    public void setClientTimeoutMs(long ms)

### setJSONCommented

    public void setJSONCommented(boolean commented)

  Parameters:
    `commented` - the commented to set

### setLogLevel

    public void setLogLevel(int logLevel)

  Parameters:
    `logLevel` - the logLevel: 0=none, 1=info, 2=debug

### getAlwaysResumePoll

    public boolean getAlwaysResumePoll()

### setAlwaysResumePoll

    public void setAlwaysResumePoll(boolean always)

  Parameters:
    `always` - True if polls are always resumed when messages are received. This may be needed for some cross domain transports.

### setSecurityPolicy

    public void setSecurityPolicy(SecurityPolicy securityPolicy)

  Specified by:
    `setSecurityPolicy` in interface `Bayeux`

### subscribe

    public void subscribe(String toChannel,
                          Client subscriber)

  Description copied from interface: `Bayeux`
  Subscribe to a channel. Equivalent to getChannel(toChannel).subscribe(subscriber).

  Specified by:
    `subscribe` in interface `Bayeux`

### unsubscribe

    public void unsubscribe(String toChannel,
                            Client subscriber)

  Description copied from interface: `Bayeux`
  Unsubscribe to a channel

  Specified by:
    `unsubscribe` in interface `Bayeux`

### getMultiFrameInterval

    public int getMultiFrameInterval()

  Returns:
    the multiFrameInterval in milliseconds

### setMultiFrameInterval

    public void setMultiFrameInterval(int multiFrameInterval)

  The time a client should delay between reconnects when multiple connections from the same browser are detected. This effectively produces traditional polling.

  Parameters:
    `multiFrameInterval` - the multiFrameInterval to set

### getAdvice

    public Object getAdvice()

### setAdvice

    public void setAdvice(Object advice)

### initialize

    protected void initialize(ServletContext context)

### getRandom

    protected long getRandom(long variation)

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2007 Mort Bay Consulting. All Rights Reserved.