Package org.cometd.client.transport
Class ClientTransport
- java.lang.Object
-
- org.cometd.common.AbstractTransport
-
- org.cometd.client.transport.ClientTransport
-
- All Implemented Interfaces:
Transport
- Direct Known Subclasses:
HttpClientTransport
public abstract class ClientTransport extends AbstractTransport
ClientTransport
s are used byBayeuxClient
to send and receive Bayeux messages.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
ClientTransport.Factory
static interface
ClientTransport.FailureHandler
static class
ClientTransport.FailureInfo
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
JSON_CONTEXT_OPTION
static java.lang.String
MAX_MESSAGE_SIZE_OPTION
static java.lang.String
MAX_NETWORK_DELAY_OPTION
static java.lang.String
MAX_SEND_BAYEUX_MESSAGE_SIZE_OPTION
static java.lang.String
SCHEDULER_OPTION
static java.lang.String
URL_OPTION
-
Constructor Summary
Constructors Modifier Constructor Description protected
ClientTransport(java.lang.String name, java.lang.String url, java.util.Map<java.lang.String,java.lang.Object> options)
Deprecated.protected
ClientTransport(java.lang.String name, java.lang.String url, java.util.Map<java.lang.String,java.lang.Object> options, java.util.concurrent.ScheduledExecutorService scheduler)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract void
abort(java.lang.Throwable failure)
Aborts this transport, usually by cancelling all pending Bayeux messages that require a response, such as/meta/connect
s, without waiting for a response.abstract boolean
accept(java.lang.String version)
protected java.lang.String
generateJSON(java.util.List<Message.Mutable> messages)
protected JSONContext.Client
getJSONContextClient()
long
getMaxNetworkDelay()
protected java.util.concurrent.ScheduledExecutorService
getScheduler()
java.lang.String
getURL()
void
init()
protected void
initScheduler()
protected java.util.List<Message.Mutable>
parseMessages(java.lang.String content)
abstract void
send(TransportListener listener, java.util.List<Message.Mutable> messages)
protected void
setMaxNetworkDelay(long maxNetworkDelay)
void
setURL(java.lang.String url)
protected void
shutdownScheduler()
void
terminate()
Terminates this transport, usually by closing network connections opened directly by this transport.-
Methods inherited from class org.cometd.common.AbstractTransport
getName, getOption, getOption, getOption, getOption, getOption, getOptionNames, getOptionPrefix, setOption, setOptionPrefix
-
-
-
-
Field Detail
-
URL_OPTION
public static final java.lang.String URL_OPTION
- See Also:
- Constant Field Values
-
MAX_NETWORK_DELAY_OPTION
public static final java.lang.String MAX_NETWORK_DELAY_OPTION
- See Also:
- Constant Field Values
-
JSON_CONTEXT_OPTION
public static final java.lang.String JSON_CONTEXT_OPTION
- See Also:
- Constant Field Values
-
SCHEDULER_OPTION
public static final java.lang.String SCHEDULER_OPTION
- See Also:
- Constant Field Values
-
MAX_SEND_BAYEUX_MESSAGE_SIZE_OPTION
public static final java.lang.String MAX_SEND_BAYEUX_MESSAGE_SIZE_OPTION
- See Also:
- Constant Field Values
-
MAX_MESSAGE_SIZE_OPTION
public static final java.lang.String MAX_MESSAGE_SIZE_OPTION
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
ClientTransport
@Deprecated protected ClientTransport(java.lang.String name, java.lang.String url, java.util.Map<java.lang.String,java.lang.Object> options)
Deprecated.
-
ClientTransport
protected ClientTransport(java.lang.String name, java.lang.String url, java.util.Map<java.lang.String,java.lang.Object> options, java.util.concurrent.ScheduledExecutorService scheduler)
-
-
Method Detail
-
getURL
public java.lang.String getURL()
-
setURL
public void setURL(java.lang.String url)
-
init
public void init()
-
getJSONContextClient
protected JSONContext.Client getJSONContextClient()
-
initScheduler
protected void initScheduler()
-
shutdownScheduler
protected void shutdownScheduler()
-
getScheduler
protected java.util.concurrent.ScheduledExecutorService getScheduler()
-
abort
public abstract void abort(java.lang.Throwable failure)
Aborts this transport, usually by cancelling all pending Bayeux messages that require a response, such as/meta/connect
s, without waiting for a response.- Parameters:
failure
- the cause of the abort- See Also:
BayeuxClient.abort()
-
terminate
public void terminate()
Terminates this transport, usually by closing network connections opened directly by this transport.- See Also:
ClientSession.disconnect()
-
accept
public abstract boolean accept(java.lang.String version)
-
send
public abstract void send(TransportListener listener, java.util.List<Message.Mutable> messages)
-
parseMessages
protected java.util.List<Message.Mutable> parseMessages(java.lang.String content) throws java.text.ParseException
- Throws:
java.text.ParseException
-
generateJSON
protected java.lang.String generateJSON(java.util.List<Message.Mutable> messages)
-
getMaxNetworkDelay
public long getMaxNetworkDelay()
-
setMaxNetworkDelay
protected void setMaxNetworkDelay(long maxNetworkDelay)
-
-