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, ClientSession, TransportListener
When the client is started, a handshake is initialised and the
call to start will block until either a successful handshake or
all known servers have been tried.
Constructor Summary |
BayeuxClient(org.eclipse.jetty.client.HttpClient httpClient,
org.eclipse.jetty.client.Address address,
java.lang.String uri)
Deprecated. |
BayeuxClient(org.eclipse.jetty.client.HttpClient httpClient,
org.eclipse.jetty.client.Address address,
java.lang.String uri,
java.util.Timer timer)
Deprecated. |
BayeuxClient(org.eclipse.jetty.client.HttpClient httpClient,
java.lang.String url)
|
BayeuxClient(java.lang.String url)
|
BayeuxClient(java.lang.String url,
ClientTransport... transports)
|
BayeuxClient(java.lang.String url,
org.eclipse.jetty.client.HttpClient httpClient)
|
BayeuxClient(java.lang.String url,
java.util.concurrent.ScheduledExecutorService scheduler,
ClientTransport... transports)
|
BayeuxClient(java.lang.String url,
java.util.concurrent.ScheduledExecutorService scheduler,
org.eclipse.jetty.client.HttpClient httpClient,
ClientTransport... transports)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
BAYEUX_VERSION
public static final java.lang.String BAYEUX_VERSION
- See Also:
- Constant Field Values
_scheduler
protected final java.util.concurrent.ScheduledExecutorService _scheduler
BayeuxClient
public BayeuxClient(org.eclipse.jetty.client.HttpClient httpClient,
org.eclipse.jetty.client.Address address,
java.lang.String uri)
- Deprecated.
BayeuxClient
public BayeuxClient(org.eclipse.jetty.client.HttpClient httpClient,
org.eclipse.jetty.client.Address address,
java.lang.String uri,
java.util.Timer timer)
- Deprecated.
BayeuxClient
public BayeuxClient(org.eclipse.jetty.client.HttpClient httpClient,
java.lang.String url)
BayeuxClient
public BayeuxClient(java.lang.String url)
BayeuxClient
public BayeuxClient(java.lang.String url,
ClientTransport... transports)
BayeuxClient
public BayeuxClient(java.lang.String url,
org.eclipse.jetty.client.HttpClient httpClient)
BayeuxClient
public BayeuxClient(java.lang.String url,
java.util.concurrent.ScheduledExecutorService scheduler,
ClientTransport... transports)
BayeuxClient
public BayeuxClient(java.lang.String url,
java.util.concurrent.ScheduledExecutorService scheduler,
org.eclipse.jetty.client.HttpClient httpClient,
ClientTransport... transports)
customize
public void customize(org.eclipse.jetty.client.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
disconnect
public void disconnect()
- Specified by:
disconnect
in interface Session
- See Also:
Session.disconnect()
getAllowedTransports
public java.util.List<java.lang.String> getAllowedTransports()
- Specified by:
getAllowedTransports
in interface Bayeux
getCookie
public org.cometd.client.BayeuxClient.ExpirableCookie getCookie(java.lang.String name)
getId
public java.lang.String getId()
- Specified by:
getId
in interface Session
getKnownTransportNames
public java.util.Set<java.lang.String> getKnownTransportNames()
- Specified by:
getKnownTransportNames
in interface Bayeux
getOption
public java.lang.Object getOption(java.lang.String qualifiedName)
- Specified by:
getOption
in interface Bayeux
- See Also:
Bayeux.getOption(java.lang.String)
getOptionNames
public java.util.Set<java.lang.String> getOptionNames()
- Specified by:
getOptionNames
in interface Bayeux
- See Also:
Bayeux.getOptionNames()
getOptions
public java.util.Map<java.lang.String,java.lang.Object> getOptions()
getTransport
public Transport getTransport(java.lang.String transport)
- Specified by:
getTransport
in interface Bayeux
handshake
public void handshake()
- Specified by:
handshake
in interface ClientSession
- See Also:
onConnectException(Throwable)
,
onException(Throwable)
,
onExpire()
handshake
public void handshake(java.util.Map<java.lang.String,java.lang.Object> template)
- Specified by:
handshake
in interface ClientSession
- See Also:
onConnectException(Throwable)
,
onException(Throwable)
,
onExpire()
handshake
public BayeuxClient.State handshake(long waitMs)
handshake
public BayeuxClient.State handshake(java.util.Map<java.lang.String,java.lang.Object> template,
long waitMs)
isConnected
public boolean isConnected()
- Specified by:
isConnected
in interface Session
setCookie
public void setCookie(java.lang.String name,
java.lang.String value)
setCookie
public void setCookie(java.lang.String name,
java.lang.String value,
int maxAge)
setOption
public void setOption(java.lang.String qualifiedName,
java.lang.Object value)
- Specified by:
setOption
in interface Bayeux
- See Also:
Bayeux.setOption(java.lang.String, java.lang.Object)
doDisconnected
protected void doDisconnected()
- Specified by:
doDisconnected
in class AbstractClientSession
- See Also:
AbstractClientSession.doDisconnected()
doSend
protected void doSend(Message.Mutable message)
newChannel
protected AbstractClientSession.AbstractSessionChannel newChannel(ChannelId channelId)
- Specified by:
newChannel
in class AbstractClientSession
- See Also:
AbstractClientSession.newChannel(org.cometd.common.ChannelId)
newChannelId
protected ChannelId newChannelId(java.lang.String channelId)
- Specified by:
newChannelId
in class AbstractClientSession
- See Also:
AbstractClientSession.newChannelId(java.lang.String)
newMessage
protected Message.Mutable newMessage()
processConnect
protected void processConnect(Message handshake)
processDisconnect
protected void processDisconnect(Message handshake)
processHandshake
protected void processHandshake(Message handshake)
receive
protected void receive(java.util.List<Message.Mutable> incomingMessages)
send
protected void send(Message.Mutable message)
sendBatch
protected void sendBatch()
- Specified by:
sendBatch
in class AbstractClientSession
- See Also:
AbstractClientSession.sendBatch()
updateTransport
protected void updateTransport(ClientTransport transport)
waitFor
public boolean waitFor(long waitMs,
BayeuxClient.State... states)
toString
public java.lang.String toString()
- Overrides:
toString
in class java.lang.Object
onConnectException
public void onConnectException(java.lang.Throwable x)
- Specified by:
onConnectException
in interface TransportListener
onException
public void onException(java.lang.Throwable x)
- Specified by:
onException
in interface TransportListener
onExpire
public void onExpire()
- Specified by:
onExpire
in interface TransportListener
onMessages
public void onMessages(java.util.List<Message.Mutable> messages)
- Specified by:
onMessages
in interface TransportListener
onProtocolError
public void onProtocolError(java.lang.String info)
- Specified by:
onProtocolError
in interface TransportListener
Copyright © 2010 Dojo Foundation. All Rights Reserved.