|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.mortbay.cometd.MessagePool
org.mortbay.cometd.AbstractBayeux
public abstract class AbstractBayeux
Nested Class Summary | |
---|---|
protected class |
AbstractBayeux.ConnectHandler
|
static class |
AbstractBayeux.DefaultPolicy
|
protected class |
AbstractBayeux.DisconnectHandler
|
protected class |
AbstractBayeux.Handler
|
protected class |
AbstractBayeux.HandshakeHandler
|
protected class |
AbstractBayeux.MetaPublishHandler
|
protected class |
AbstractBayeux.PingHandler
|
protected class |
AbstractBayeux.PublishHandler
|
protected class |
AbstractBayeux.ServiceChannel
|
protected class |
AbstractBayeux.SubscribeHandler
|
protected class |
AbstractBayeux.UnsubscribeHandler
|
Constructor Summary | |
---|---|
protected |
AbstractBayeux()
|
Method Summary | |
---|---|
void |
addExtension(Extension ext)
|
void |
addFilter(String channels,
DataFilter filter)
Deprecated. user Channel#addFilter |
void |
deliver(Client fromClient,
Client toClient,
String toChannel,
Message message)
Deprecated. use Client.deliver(Client, Message) |
protected void |
doPublish(ChannelId to,
Client from,
Object data,
String msgId)
Publish data to a channel. |
Object |
getAdvice()
|
ChannelImpl |
getChannel(ChannelId id)
|
ChannelImpl |
getChannel(String id)
|
Channel |
getChannel(String id,
boolean create)
Get a Channel instance by ID. |
ChannelId |
getChannelId(String id)
|
Collection<Channel> |
getChannels()
Get all known channels. |
Client |
getClient(String client_id)
|
Set<String> |
getClientIDs()
|
Collection<Client> |
getClients()
|
HttpServletRequest |
getCurrentRequest()
|
List<Extension> |
getExtensions()
|
long |
getInterval()
|
int |
getLogLevel()
|
long |
getMaxInterval()
|
int |
getMultiFrameInterval()
|
SecurityPolicy |
getSecurityPolicy()
|
long |
getTimeout()
|
String |
handle(ClientImpl client,
Transport transport,
Message message)
Handle a Bayeux message. |
boolean |
hasChannel(String id)
|
boolean |
hasClient(String clientId)
|
protected void |
initialize(ServletContext context)
|
boolean |
isDirectDeliver()
|
boolean |
isInitialized()
|
boolean |
isJSONCommented()
|
boolean |
isLogDebug()
|
boolean |
isLogInfo()
|
boolean |
isRequestAvailable()
|
void |
logDebug(String message)
|
void |
logDebug(String message,
Throwable th)
|
void |
logInfo(String message)
|
void |
logWarn(String message)
|
void |
logWarn(String message,
Throwable th)
|
Client |
newClient(String idPrefix)
|
Client |
newClient(String idPrefix,
Listener listener)
Deprecated. use newClient(String) |
abstract ClientImpl |
newRemoteClient()
|
Transport |
newTransport(ClientImpl client,
Map<?,?> message)
Create new transport object for a bayeux message |
void |
publish(Client fromClient,
String toChannelId,
Object data,
String msgId)
Deprecated. use Channel.publish(Client, Object, String) |
boolean |
removeChannel(ChannelId channelId)
|
Channel |
removeChannel(String channelId)
|
Client |
removeClient(String client_id)
|
void |
removeExtension(Extension ext)
|
void |
removeFilter(String channels,
DataFilter filter)
|
void |
setAdvice(Object advice)
|
void |
setDirectDeliver(boolean directDeliver)
|
void |
setInterval(long ms)
|
void |
setJSONCommented(boolean commented)
|
void |
setLogLevel(int logLevel)
|
void |
setMaxInterval(long ms)
|
void |
setMultiFrameInterval(int multiFrameInterval)
The time a client should delay between reconnects when multiple connections from the same browser are detected. |
void |
setRequestAvailable(boolean requestAvailable)
|
void |
setSecurityPolicy(SecurityPolicy securityPolicy)
Set the security policy for the Bayeux instance. |
void |
setTimeout(long ms)
|
void |
subscribe(String toChannel,
Client subscriber)
Subscribe to a channel. |
void |
unsubscribe(String toChannel,
Client subscriber)
Unsubscribe to a channel |
Methods inherited from class org.mortbay.cometd.MessagePool |
---|
getBatchJSON, getJSON, getMsgJSON, newMessage, newMessage, parse, parse, parseTo, recycleMessage, setBatchJSON, setJSON, setMsgJSON |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final ChannelId META_ID
public static final ChannelId META_CONNECT_ID
public static final ChannelId META_CLIENT_ID
public static final ChannelId META_DISCONNECT_ID
public static final ChannelId META_HANDSHAKE_ID
public static final ChannelId META_PING_ID
public static final ChannelId META_STATUS_ID
public static final ChannelId META_SUBSCRIBE_ID
public static final ChannelId META_UNSUBSCRIBE_ID
public static final JSON.Literal TRANSPORTS
protected SecurityPolicy _securityPolicy
protected Object _advice
protected int _adviceVersion
protected Object _unknownAdvice
protected int _logLevel
protected long _timeout
protected long _interval
protected long _maxInterval
protected boolean _JSONCommented
protected boolean _initialized
protected ConcurrentHashMap<String,List<String>> _browser2client
protected int _multiFrameInterval
protected JSON.Literal _multiFrameAdvice
protected boolean _directDeliver
protected boolean _requestAvailable
protected ThreadLocal<HttpServletRequest> _request
protected AbstractBayeux.Handler _publishHandler
protected AbstractBayeux.Handler _metaPublishHandler
protected List<Extension> _extensions
Constructor Detail |
---|
protected AbstractBayeux()
context.
- The logLevel init parameter is used to set the logging to
0=none, 1=info, 2=debugMethod Detail |
---|
public void addFilter(String channels, DataFilter filter)
Channel#addFilter
addFilter
in interface Bayeux
channels
- A ChannelId
filter
- The filter instance to apply to new channels matching the
patternpublic void removeFilter(String channels, DataFilter filter)
removeFilter
in interface Bayeux
public void addExtension(Extension ext)
public List<Extension> getExtensions()
public void removeExtension(Extension ext)
public ChannelImpl getChannel(ChannelId id)
id
-
public ChannelImpl getChannel(String id)
public Channel getChannel(String id, boolean create)
Bayeux
getChannel
in interface Bayeux
id
- The Channel IDcreate
- If true, a channel will be created if it does not exist.
public ChannelId getChannelId(String id)
public Client getClient(String client_id)
getClient
in interface Bayeux
public Set<String> getClientIDs()
public long getMaxInterval()
public int getLogLevel()
public SecurityPolicy getSecurityPolicy()
getSecurityPolicy
in interface Bayeux
public long getTimeout()
public long getInterval()
public boolean isDirectDeliver()
public void setDirectDeliver(boolean directDeliver)
directDeliver
- true if published messages are directly delivered to subscribers. False if
a new message is to be created that holds only supported fields.public String handle(ClientImpl client, Transport transport, Message message) throws IOException
client
- The client if knowntransport
- The transport to use for the messagemessage
- The bayeux message.
IOException
public boolean hasChannel(String id)
hasChannel
in interface Bayeux
public boolean isInitialized()
public boolean isJSONCommented()
public boolean isLogDebug()
public boolean isLogInfo()
public void logDebug(String message)
public void logDebug(String message, Throwable th)
public void logWarn(String message, Throwable th)
public void logWarn(String message)
public void logInfo(String message)
public Client newClient(String idPrefix)
newClient
in interface Bayeux
public Client newClient(String idPrefix, Listener listener)
newClient(String)
newClient
in interface Bayeux
public abstract ClientImpl newRemoteClient()
public Transport newTransport(ClientImpl client, Map<?,?> message)
client
- The clientmessage
- the bayeux message
protected void doPublish(ChannelId to, Client from, Object data, String msgId)
to
- from
- data
- msgId
- public void publish(Client fromClient, String toChannelId, Object data, String msgId)
Channel.publish(Client, Object, String)
Bayeux
publish
in interface Bayeux
fromClient
- The client sending the datatoChannelId
- The Channel ID to which the data is targetteddata
- 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.public void deliver(Client fromClient, Client toClient, String toChannel, Message message)
Client.deliver(Client, Message)
deliver
in interface Bayeux
Bayeux.deliver(dojox.cometd.Client, dojox.cometd.Client, java.lang.String, dojox.cometd.Message)
public boolean removeChannel(ChannelId channelId)
public Client removeClient(String client_id)
removeClient
in interface Bayeux
public void setMaxInterval(long ms)
ms
- The maximum time in ms to wait between polls before timing out a clientpublic void setJSONCommented(boolean commented)
commented
- the commented to setpublic void setLogLevel(int logLevel)
logLevel
- the logLevel: 0=none, 1=info, 2=debugpublic void setSecurityPolicy(SecurityPolicy securityPolicy)
Bayeux
The Security Policy will be called to check access for all handshakes, subscriptions and publishing.
setSecurityPolicy
in interface Bayeux
securityPolicy
- The security policy instance.public void setTimeout(long ms)
public void setInterval(long ms)
public boolean isRequestAvailable()
getCurrentRequest()
will return the current requestpublic void setRequestAvailable(boolean requestAvailable)
requestAvailable
- TRUE if getCurrentRequest()
will return the current requestpublic HttpServletRequest getCurrentRequest()
isRequestAvailable()
is true, else nullpublic void subscribe(String toChannel, Client subscriber)
Bayeux
subscribe
in interface Bayeux
public void unsubscribe(String toChannel, Client subscriber)
Bayeux
unsubscribe
in interface Bayeux
public int getMultiFrameInterval()
public void setMultiFrameInterval(int multiFrameInterval)
multiFrameInterval
- the multiFrameInterval to setpublic Object getAdvice()
public void setAdvice(Object advice)
public Collection<Channel> getChannels()
Bayeux
getChannels
in interface Bayeux
public Collection<Client> getClients()
getClients
in interface Bayeux
public boolean hasClient(String clientId)
hasClient
in interface Bayeux
public Channel removeChannel(String channelId)
removeChannel
in interface Bayeux
protected void initialize(ServletContext context)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |