|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.eclipse.jetty.util.component.AbstractLifeCycle
org.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.eclipse.jetty.util.component.LifeCycle |
|---|
org.eclipse.jetty.util.component.LifeCycle.Listener |
| Field Summary | |
|---|---|
protected org.eclipse.jetty.client.Address |
_cometdAddress
|
protected Extension[] |
_extensions
|
protected org.eclipse.jetty.client.HttpClient |
_httpClient
|
protected org.eclipse.jetty.util.ajax.JSON |
_jsonOut
|
protected MessagePool |
_msgPool
|
| Fields inherited from class org.eclipse.jetty.util.component.AbstractLifeCycle |
|---|
_listeners, FAILED, RUNNING, STARTED, STARTING, STOPPED, STOPPING |
| Constructor Summary | |
|---|---|
BayeuxClient(org.eclipse.jetty.client.HttpClient client,
org.eclipse.jetty.client.Address address,
java.lang.String uri)
|
|
BayeuxClient(org.eclipse.jetty.client.HttpClient client,
org.eclipse.jetty.client.Address address,
java.lang.String path,
java.util.Timer timer)
|
|
BayeuxClient(org.eclipse.jetty.client.HttpClient client,
java.lang.String url)
|
|
BayeuxClient(org.eclipse.jetty.client.HttpClient client,
java.lang.String url,
java.util.Timer timer)
|
|
| Method Summary | |
|---|---|
void |
addExtension(Extension ext)
|
void |
addListener(ClientListener listener)
|
protected void |
customize(org.eclipse.jetty.client.HttpExchange exchange)
Customize an Exchange. |
void |
deliver(Client from,
Message message)
(non-Javadoc) |
void |
deliver(Client from,
java.lang.String toChannel,
java.lang.Object data,
java.lang.String id)
|
void |
disconnect()
Disconnect this client. |
protected void |
doStart()
|
protected void |
doStop()
|
void |
endBatch()
|
protected void |
extendIn(Message message)
Called to extend inbound messages |
protected void |
extendOut(Message message)
Called to extend outbound messages |
protected java.lang.String |
extendOut(java.lang.String msg)
Called to extend outbound string messages. |
int |
getBackoffInterval()
|
int |
getBackoffMaxRetries()
|
java.lang.String |
getId()
|
Listener |
getListener()
Deprecated. |
int |
getMaxQueue()
|
java.util.Queue<Message> |
getQueue()
|
boolean |
hasMessages()
|
protected boolean |
isInitialized()
|
boolean |
isLocal()
|
boolean |
isPolling()
|
protected void |
metaConnect(boolean success,
Message message)
Called with the results of a /meta/connect message |
protected void |
metaHandshake(boolean success,
boolean reestablish,
Message message)
Called with the results of a /meta/handshake message |
protected void |
metaPublishFail(java.lang.Throwable e,
Message[] messages)
Called with the results of a failed publish |
void |
publish(java.lang.String toChannel,
java.lang.Object data,
java.lang.String msgId)
|
void |
remove()
Deprecated. use disconnect() |
void |
removeListener(ClientListener listener)
|
protected boolean |
send(BayeuxClient.Exchange exchange,
boolean backoff)
Send the exchange, possibly using a backoff. |
protected void |
send(org.eclipse.jetty.client.HttpExchange exchange)
Send the exchange. |
void |
setBackOffInterval(int interval)
If unable to connect/handshake etc, even if following the interval in the advice, wait for this interval and try again, up to a maximum of _backoffRetries |
void |
setBackoffMaxRetries(int retries)
|
void |
setCookie(javax.servlet.http.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(Listener listener)
Deprecated. |
void |
setMaxQueue(int max)
|
void |
startBatch()
|
void |
subscribe(java.lang.String toChannel)
|
java.util.List<Message> |
takeMessages()
|
void |
unsubscribe(java.lang.String toChannel)
|
| Methods inherited from class org.eclipse.jetty.util.component.AbstractLifeCycle |
|---|
addLifeCycleListener, getState, 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 org.eclipse.jetty.client.HttpClient _httpClient
protected MessagePool _msgPool
protected org.eclipse.jetty.client.Address _cometdAddress
protected Extension[] _extensions
protected org.eclipse.jetty.util.ajax.JSON _jsonOut
| Constructor Detail |
|---|
public BayeuxClient(org.eclipse.jetty.client.HttpClient client,
java.lang.String url)
public BayeuxClient(org.eclipse.jetty.client.HttpClient client,
java.lang.String url,
java.util.Timer timer)
public BayeuxClient(org.eclipse.jetty.client.HttpClient client,
org.eclipse.jetty.client.Address address,
java.lang.String path,
java.util.Timer timer)
public BayeuxClient(org.eclipse.jetty.client.HttpClient client,
org.eclipse.jetty.client.Address address,
java.lang.String uri)
| Method Detail |
|---|
public void addExtension(Extension ext)
addExtension in interface Clientpublic void setBackOffInterval(int interval)
interval - public int getBackoffInterval()
public void setBackoffMaxRetries(int retries)
public int getBackoffMaxRetries()
public java.lang.String getId()
getId in interface Client
protected void doStart()
throws java.lang.Exception
doStart in class org.eclipse.jetty.util.component.AbstractLifeCyclejava.lang.Exception
protected void doStop()
throws java.lang.Exception
doStop in class org.eclipse.jetty.util.component.AbstractLifeCyclejava.lang.Exceptionpublic boolean isPolling()
public void deliver(Client from,
Message message)
public void deliver(Client from,
java.lang.String toChannel,
java.lang.Object data,
java.lang.String id)
deliver in interface Clientpublic Listener getListener()
public boolean hasMessages()
hasMessages in interface Clientpublic boolean isLocal()
isLocal in interface Client
public void publish(java.lang.String toChannel,
java.lang.Object data,
java.lang.String msgId)
public void subscribe(java.lang.String toChannel)
public void unsubscribe(java.lang.String toChannel)
public void remove()
disconnect()
public void disconnect()
disconnect in interface Clientpublic void setListener(Listener listener)
public java.util.List<Message> takeMessages()
takeMessages in interface Clientpublic void endBatch()
endBatch in interface Clientpublic void startBatch()
startBatch in interface Clientprotected void customize(org.eclipse.jetty.client.HttpExchange exchange)
public void setCookie(javax.servlet.http.Cookie cookie)
public void addListener(ClientListener listener)
addListener in interface Clientpublic void removeListener(ClientListener listener)
removeListener in interface Clientpublic int getMaxQueue()
getMaxQueue in interface Clientpublic java.util.Queue<Message> getQueue()
getQueue in interface Clientpublic void setMaxQueue(int max)
setMaxQueue in interface Client
protected boolean send(BayeuxClient.Exchange exchange,
boolean backoff)
exchange - backoff - if true, use backoff algorithm to send
protected void send(org.eclipse.jetty.client.HttpExchange exchange)
throws java.io.IOException
exchange -
java.io.IOExceptionprotected void setInitialized(boolean b)
b - protected boolean isInitialized()
protected void metaConnect(boolean success,
Message message)
success - connect was returned with this status
protected void metaHandshake(boolean success,
boolean reestablish,
Message message)
success - connect was returned with this statusreestablish - the client was previously connected.
protected void metaPublishFail(java.lang.Throwable e,
Message[] messages)
protected java.lang.String extendOut(java.lang.String msg)
extendOut(Message) method to efficiently cater for these
preformatted strings.
This method calls the Extensions added by addExtension(Extension)
msg -
protected void extendOut(Message message)
This method calls the Extensions added by addExtension(Extension)
protected void extendIn(Message message)
This method calls the Extensions added by addExtension(Extension)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||