|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.mortbay.component.AbstractLifeCycle
org.mortbay.cometd.client.BayeuxClient
public class BayeuxClient
Bayeux protocol Client.
Implements a Bayeux Ajax Push client as part of the cometd project.
The HttpClient attributes are used to share a Timer and MessagePool instance between all Bayeux clients sharing the same HttpClient.
http://cometd.org
Nested Class Summary | |
---|---|
protected class |
BayeuxClient.Connect
The Bayeux Connect exchange. |
protected class |
BayeuxClient.Exchange
The base class for all bayeux exchanges. |
protected class |
BayeuxClient.Handshake
The Bayeux handshake exchange. |
protected class |
BayeuxClient.Publish
Publish message exchange. |
Nested classes/interfaces inherited from interface org.mortbay.component.LifeCycle |
---|
LifeCycle.Listener |
Field Summary | |
---|---|
protected Address |
_cometdAddress
|
protected org.cometd.Extension[] |
_extensions
|
protected HttpClient |
_httpClient
|
protected JSON |
_jsonOut
|
protected MessagePool |
_msgPool
|
Fields inherited from class org.mortbay.component.AbstractLifeCycle |
---|
_listeners |
Constructor Summary | |
---|---|
BayeuxClient(HttpClient client,
Address address,
String uri)
|
|
BayeuxClient(HttpClient client,
Address address,
String path,
Timer timer)
|
|
BayeuxClient(HttpClient client,
String url)
|
|
BayeuxClient(HttpClient client,
String url,
Timer timer)
|
Method Summary | |
---|---|
void |
addExtension(org.cometd.Extension ext)
|
void |
addListener(org.cometd.ClientListener listener)
|
protected void |
customize(HttpExchange exchange)
Customize an Exchange. |
void |
deliver(org.cometd.Client from,
org.cometd.Message message)
(non-Javadoc) |
void |
deliver(org.cometd.Client from,
String toChannel,
Object data,
String id)
|
void |
disconnect()
Disconnect this client. |
protected void |
doStart()
|
protected void |
doStop()
|
void |
endBatch()
|
protected void |
extendIn(org.cometd.Message message)
Called to extend inbound messages |
protected void |
extendOut(org.cometd.Message message)
Called to extend outbound messages |
protected String |
extendOut(String msg)
Called to extend outbound string messages. |
int |
getBackoffIncrement()
|
int |
getBackoffInterval()
|
int |
getBackoffMaxInterval()
|
int |
getBackoffMaxRetries()
Deprecated. |
Cookie |
getCookie(String name)
|
String |
getId()
|
org.cometd.Listener |
getListener()
Deprecated. |
int |
getMaxQueue()
|
Queue<org.cometd.Message> |
getQueue()
|
boolean |
hasMessages()
|
protected boolean |
isInitialized()
|
boolean |
isLocal()
|
boolean |
isPolling()
|
protected void |
metaConnect(boolean success,
org.cometd.Message message)
Called with the results of a /meta/connect message |
protected void |
metaHandshake(boolean success,
boolean reestablish,
org.cometd.Message message)
Called with the results of a /meta/handshake message |
protected void |
metaPublishFail(Throwable e,
org.cometd.Message[] messages)
Called with the results of a failed publish |
void |
publish(String toChannel,
Object data,
String msgId)
|
void |
remove()
Deprecated. use disconnect() |
void |
removeListener(org.cometd.ClientListener listener)
|
protected boolean |
send(BayeuxClient.Exchange exchange,
boolean backoff)
Send the exchange, possibly using a backoff. |
protected void |
send(HttpExchange exchange)
Send the exchange. |
void |
setBackoffIncrement(int interval)
. |
void |
setBackOffInterval(int interval)
If unable to connect/handshake etc, even if following the interval in the advice, wait for this interval initially, and try again. |
void |
setBackoffMaxInterval(int interval)
|
void |
setBackoffMaxRetries(int retries)
Deprecated. We retry an infinite number of times. use getBackoffIncrement() to set limits |
void |
setCookie(Cookie cookie)
|
protected void |
setInitialized(boolean b)
False when we have received a success=false message in response to a Connect, or we have had an exception when sending or receiving a Connect. |
void |
setListener(org.cometd.Listener listener)
Deprecated. |
void |
setMaxQueue(int max)
|
void |
startBatch()
|
void |
subscribe(String toChannel)
|
List<org.cometd.Message> |
takeMessages()
|
void |
unsubscribe(String toChannel)
|
Methods inherited from class org.mortbay.component.AbstractLifeCycle |
---|
addLifeCycleListener, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeLifeCycleListener, start, stop |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected HttpClient _httpClient
protected MessagePool _msgPool
protected Address _cometdAddress
protected org.cometd.Extension[] _extensions
protected JSON _jsonOut
Constructor Detail |
---|
public BayeuxClient(HttpClient client, String url)
public BayeuxClient(HttpClient client, String url, Timer timer)
public BayeuxClient(HttpClient client, Address address, String path, Timer timer)
public BayeuxClient(HttpClient client, Address address, String uri)
Method Detail |
---|
public void addExtension(org.cometd.Extension ext)
addExtension
in interface org.cometd.Client
public void setBackOffInterval(int interval)
interval
- public int getBackoffInterval()
public void setBackoffMaxRetries(int retries)
getBackoffIncrement()
to set limits
public int getBackoffMaxRetries()
public void setBackoffIncrement(int interval)
public int getBackoffIncrement()
public void setBackoffMaxInterval(int interval)
public int getBackoffMaxInterval()
public String getId()
getId
in interface org.cometd.Client
protected void doStart() throws Exception
doStart
in class AbstractLifeCycle
Exception
protected void doStop() throws Exception
doStop
in class AbstractLifeCycle
Exception
public boolean isPolling()
public void deliver(org.cometd.Client from, org.cometd.Message message)
public void deliver(org.cometd.Client from, String toChannel, Object data, String id)
deliver
in interface org.cometd.Client
public org.cometd.Listener getListener()
public boolean hasMessages()
hasMessages
in interface org.cometd.Client
public boolean isLocal()
isLocal
in interface org.cometd.Client
public void publish(String toChannel, Object data, String msgId)
public void subscribe(String toChannel)
public void unsubscribe(String toChannel)
public void remove()
disconnect()
public void disconnect()
disconnect
in interface org.cometd.Client
public void setListener(org.cometd.Listener listener)
public List<org.cometd.Message> takeMessages()
takeMessages
in interface org.cometd.Client
public void endBatch()
endBatch
in interface org.cometd.Client
public void startBatch()
startBatch
in interface org.cometd.Client
protected void customize(HttpExchange exchange)
public void setCookie(Cookie cookie)
public Cookie getCookie(String name)
public void addListener(org.cometd.ClientListener listener)
addListener
in interface org.cometd.Client
public void removeListener(org.cometd.ClientListener listener)
removeListener
in interface org.cometd.Client
public int getMaxQueue()
getMaxQueue
in interface org.cometd.Client
public Queue<org.cometd.Message> getQueue()
getQueue
in interface org.cometd.Client
public void setMaxQueue(int max)
setMaxQueue
in interface org.cometd.Client
protected boolean send(BayeuxClient.Exchange exchange, boolean backoff)
exchange
- backoff
- if true, use backoff algorithm to send
protected void send(HttpExchange exchange) throws IOException
exchange
-
IOException
protected void setInitialized(boolean b)
b
- protected boolean isInitialized()
protected void metaConnect(boolean success, org.cometd.Message message)
success
- connect was returned with this statusprotected void metaHandshake(boolean success, boolean reestablish, org.cometd.Message message)
success
- connect was returned with this statusreestablish
- the client was previously connected.protected void metaPublishFail(Throwable e, org.cometd.Message[] messages)
protected String extendOut(String msg)
extendOut(Message)
method to efficiently cater for these
preformatted strings.
This method calls the Extension
s added by addExtension(Extension)
msg
-
protected void extendOut(org.cometd.Message message)
This method calls the Extension
s added by addExtension(Extension)
protected void extendIn(org.cometd.Message message)
This method calls the Extension
s added by addExtension(Extension)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |