org.mortbay.cometd.client
Class BayeuxClient

java.lang.Object
  extended by org.mortbay.cometd.MessagePool
      extended by org.mortbay.cometd.client.BayeuxClient
All Implemented Interfaces:
org.cometd.Client

public class BayeuxClient
extends MessagePool
implements org.cometd.Client

Bayeux protocol Client.

Implements a Bayeux Ajax Push client as part of the cometd project.

Author:
gregw
See Also:
http://cometd.com

Constructor Summary
BayeuxClient(HttpClient client, Address address, java.lang.String uri)
           
BayeuxClient(HttpClient client, Address address, java.lang.String uri, java.util.Timer timer)
           
 
Method Summary
 void addListener(org.cometd.ClientListener listener)
           
protected  void customize(HttpExchange exchange)
          Customize an Exchange.
 void deliver(org.cometd.Client from, org.cometd.Message message)
          Deprecated. use deliver(Client, String, Object, String)
 void deliver(org.cometd.Client from, java.lang.String toChannel, java.lang.Object data, java.lang.String id)
           
 void endBatch()
           
 java.lang.String getId()
           
 org.cometd.Listener getListener()
          Deprecated.  
 int getMaxQueue()
           
 java.util.Queue<org.cometd.Message> getQueue()
           
 boolean hasMessages()
           
 boolean isLocal()
           
 boolean isPolling()
           
 void publish(java.lang.String toChannel, java.lang.Object data, java.lang.String msgId)
           
 void remove(boolean timeout)
           
 void removeListener(org.cometd.ClientListener listener)
           
 void setCookie(Cookie cookie)
           
 void setListener(org.cometd.Listener listener)
          Deprecated.  
 void setMaxQueue(int max)
           
 void start()
           
 void startBatch()
           
 void subscribe(java.lang.String toChannel)
           
 java.util.List<org.cometd.Message> takeMessages()
           
 void unsubscribe(java.lang.String toChannel)
           
 
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
 

Constructor Detail

BayeuxClient

public BayeuxClient(HttpClient client,
                    Address address,
                    java.lang.String uri,
                    java.util.Timer timer)
             throws java.io.IOException
Throws:
java.io.IOException

BayeuxClient

public BayeuxClient(HttpClient client,
                    Address address,
                    java.lang.String uri)
             throws java.io.IOException
Throws:
java.io.IOException
Method Detail

getId

public java.lang.String getId()
Specified by:
getId in interface org.cometd.Client

start

public void start()

isPolling

public boolean isPolling()

deliver

public void deliver(org.cometd.Client from,
                    org.cometd.Message message)
Deprecated. use deliver(Client, String, Object, String)

(non-Javadoc)

See Also:
org.cometd.Client#deliver(org.cometd.Client, java.util.Map)

deliver

public void deliver(org.cometd.Client from,
                    java.lang.String toChannel,
                    java.lang.Object data,
                    java.lang.String id)
Specified by:
deliver in interface org.cometd.Client

getListener

public org.cometd.Listener getListener()
Deprecated. 


hasMessages

public boolean hasMessages()
Specified by:
hasMessages in interface org.cometd.Client

isLocal

public boolean isLocal()
Specified by:
isLocal in interface org.cometd.Client

publish

public void publish(java.lang.String toChannel,
                    java.lang.Object data,
                    java.lang.String msgId)

subscribe

public void subscribe(java.lang.String toChannel)

unsubscribe

public void unsubscribe(java.lang.String toChannel)

remove

public void remove(boolean timeout)

setListener

public void setListener(org.cometd.Listener listener)
Deprecated. 


takeMessages

public java.util.List<org.cometd.Message> takeMessages()
Specified by:
takeMessages in interface org.cometd.Client

endBatch

public void endBatch()
Specified by:
endBatch in interface org.cometd.Client

startBatch

public void startBatch()
Specified by:
startBatch in interface org.cometd.Client

customize

protected void customize(HttpExchange exchange)
Customize an Exchange. Called when an exchange is about to be sent to allow Cookies and Credentials to be customized. Default implementation sets any cookies


setCookie

public void setCookie(Cookie cookie)

addListener

public void addListener(org.cometd.ClientListener listener)
Specified by:
addListener in interface org.cometd.Client

removeListener

public void removeListener(org.cometd.ClientListener listener)
Specified by:
removeListener in interface org.cometd.Client

getMaxQueue

public int getMaxQueue()
Specified by:
getMaxQueue in interface org.cometd.Client

getQueue

public java.util.Queue<org.cometd.Message> getQueue()
Specified by:
getQueue in interface org.cometd.Client

setMaxQueue

public void setMaxQueue(int max)
Specified by:
setMaxQueue in interface org.cometd.Client


Copyright © 1995-2009 Mort Bay Consulting. All Rights Reserved.