org.cometd.client
Class BayeuxClient
java.lang.Object
org.cometd.common.AbstractClientSession
org.cometd.client.BayeuxClient
- All Implemented Interfaces:
- Bayeux, ClientSession, Session, TransportListener
public class BayeuxClient
- extends AbstractClientSession
- implements Bayeux, TransportListener
- Version:
- $Revision$ $Date$
|
Method Summary |
void |
abort()
|
protected void |
connect()
|
void |
customize(org.eclipse.jetty.client.HttpExchange exchange)
Customizes an Exchange. |
void |
disconnect()
|
protected void |
enqueueSend(Message.Mutable message)
|
protected void |
followAdvice()
|
protected Map<String,Object> |
getAdvice()
|
List<String> |
getAllowedTransports()
|
long |
getBackoffIncrement()
|
String |
getCookie(String name)
|
String |
getId()
|
Set<String> |
getKnownTransportNames()
|
long |
getMaxBackoff()
|
Object |
getOption(String qualifiedName)
|
Set<String> |
getOptionNames()
|
Map<String,Object> |
getOptions()
|
protected BayeuxClient.State |
getState()
|
Transport |
getTransport(String transport)
|
void |
handshake()
|
BayeuxClient.State |
handshake(long waitMs)
|
void |
handshake(Map<String,Object> handshakeFields)
|
BayeuxClient.State |
handshake(Map<String,Object> template,
long waitMs)
|
protected void |
initialize()
|
boolean |
isConnected()
|
boolean |
isDisconnected()
|
boolean |
isHandshook()
|
protected AbstractClientSession.AbstractSessionChannel |
newChannel(ChannelId channelId)
|
protected ChannelId |
newChannelId(String channelId)
|
protected Message.Mutable |
newMessage()
|
void |
onConnectException(Throwable x)
|
void |
onException(Throwable x)
|
void |
onExpire()
|
void |
onMessages(List<Message.Mutable> messages)
|
void |
onProtocolError(String info)
|
void |
onSending(Message[] messages)
|
protected void |
processConnect(Message connect)
|
protected void |
processDisconnect(Message disconnect)
|
protected void |
processHandshake(Message handshake)
|
void |
receive(Message message,
Message.Mutable mutable)
|
protected boolean |
scheduleAction(Runnable action,
long interval)
|
protected void |
send(Message.Mutable... messages)
|
protected void |
sendBatch()
|
void |
setCookie(String name,
String value)
|
void |
setCookie(String name,
String value,
int maxAge)
|
void |
setOption(String qualifiedName,
Object value)
|
protected void |
terminate()
|
String |
toString()
|
protected void |
updateTransport(ClientTransport newTransport)
|
boolean |
waitFor(long waitMs,
BayeuxClient.State state,
BayeuxClient.State... states)
|
| Methods inherited from class org.cometd.common.AbstractClientSession |
addExtension, batch, dump, endBatch, extendRcv, extendSend, getAttribute, getAttributeNames, getChannel, getChannels, isBatching, newMessageId, removeAttribute, removeExtension, setAttribute, startBatch |
BACKOFF_INCREMENT_OPTION
public static final String BACKOFF_INCREMENT_OPTION
- See Also:
- Constant Field Values
MAX_BACKOFF_OPTION
public static final String MAX_BACKOFF_OPTION
- See Also:
- Constant Field Values
BAYEUX_VERSION
public static final String BAYEUX_VERSION
- See Also:
- Constant Field Values
BayeuxClient
public BayeuxClient(String url,
ClientTransport transport,
ClientTransport... transports)
BayeuxClient
public BayeuxClient(String url,
ScheduledExecutorService scheduler,
ClientTransport transport,
ClientTransport... transports)
getBackoffIncrement
public long getBackoffIncrement()
getMaxBackoff
public long getMaxBackoff()
getCookie
public String getCookie(String name)
setCookie
public void setCookie(String name,
String value)
setCookie
public void setCookie(String name,
String value,
int maxAge)
getId
public String getId()
- Specified by:
getId in interface Session
isConnected
public boolean isConnected()
- Specified by:
isConnected in interface Session
isHandshook
public boolean isHandshook()
- Specified by:
isHandshook in interface Session
isDisconnected
public boolean isDisconnected()
getState
protected BayeuxClient.State getState()
handshake
public void handshake()
- Specified by:
handshake in interface ClientSession
handshake
public void handshake(Map<String,Object> handshakeFields)
- Specified by:
handshake in interface ClientSession
handshake
public BayeuxClient.State handshake(long waitMs)
handshake
public BayeuxClient.State handshake(Map<String,Object> template,
long waitMs)
waitFor
public boolean waitFor(long waitMs,
BayeuxClient.State state,
BayeuxClient.State... states)
connect
protected void connect()
newChannelId
protected ChannelId newChannelId(String channelId)
- Specified by:
newChannelId in class AbstractClientSession
newChannel
protected AbstractClientSession.AbstractSessionChannel newChannel(ChannelId channelId)
- Specified by:
newChannel in class AbstractClientSession
sendBatch
protected void sendBatch()
- Specified by:
sendBatch in class AbstractClientSession
disconnect
public void disconnect()
- Specified by:
disconnect in interface Session
abort
public void abort()
receive
public void receive(Message message,
Message.Mutable mutable)
- Overrides:
receive in class AbstractClientSession
getAdvice
protected Map<String,Object> getAdvice()
followAdvice
protected void followAdvice()
processHandshake
protected void processHandshake(Message handshake)
processConnect
protected void processConnect(Message connect)
processDisconnect
protected void processDisconnect(Message disconnect)
scheduleAction
protected boolean scheduleAction(Runnable action,
long interval)
getAllowedTransports
public List<String> getAllowedTransports()
- Specified by:
getAllowedTransports in interface Bayeux
getKnownTransportNames
public Set<String> getKnownTransportNames()
- Specified by:
getKnownTransportNames in interface Bayeux
getTransport
public Transport getTransport(String transport)
- Specified by:
getTransport in interface Bayeux
initialize
protected void initialize()
terminate
protected void terminate()
getOption
public Object getOption(String qualifiedName)
- Specified by:
getOption in interface Bayeux
setOption
public void setOption(String qualifiedName,
Object value)
- Specified by:
setOption in interface Bayeux
getOptionNames
public Set<String> getOptionNames()
- Specified by:
getOptionNames in interface Bayeux
getOptions
public Map<String,Object> getOptions()
newMessage
protected Message.Mutable newMessage()
updateTransport
protected void updateTransport(ClientTransport newTransport)
send
protected void send(Message.Mutable... messages)
enqueueSend
protected void enqueueSend(Message.Mutable message)
onSending
public void onSending(Message[] messages)
- Specified by:
onSending in interface TransportListener
onMessages
public void onMessages(List<Message.Mutable> messages)
- Specified by:
onMessages in interface TransportListener
onConnectException
public void onConnectException(Throwable x)
- Specified by:
onConnectException in interface TransportListener
onException
public void onException(Throwable x)
- Specified by:
onException in interface TransportListener
onExpire
public void onExpire()
- Specified by:
onExpire in interface TransportListener
onProtocolError
public void onProtocolError(String info)
- Specified by:
onProtocolError in interface TransportListener
customize
public void customize(org.eclipse.jetty.client.HttpExchange exchange)
- Customizes an Exchange. Called when an exchange is about to be sent to
allow Cookies and Credentials to be customized. Default implementation
sets any cookies
toString
public String toString()
- Overrides:
toString in class Object
Copyright © 2008-2010 Dojo Foundation. All Rights Reserved.