org.cometd.bayeux.server.ServerTransport
, org.cometd.bayeux.Transport
, org.eclipse.jetty.util.component.Dumpable
AbstractHttpTransport
public abstract class AbstractServerTransport extends AbstractTransport implements org.cometd.bayeux.server.ServerTransport, org.eclipse.jetty.util.component.Dumpable
The base class of all server transports.
Each derived Transport class should declare all options that it supports
by calling AbstractTransport.setOption(String, Object)
for each option.
Then during the call the init()
, each transport should
call the variants of AbstractTransport.getOption(String)
to obtained the configured
value for the option.
Modifier and Type | Class | Description |
---|---|---|
static interface |
AbstractServerTransport.Scheduler |
Modifier and Type | Field | Description |
---|---|---|
protected org.slf4j.Logger |
_logger |
|
static java.lang.String |
ALLOW_MESSAGE_DELIVERY_DURING_HANDSHAKE |
|
static java.lang.String |
HANDSHAKE_RECONNECT_OPTION |
|
static java.lang.String |
INTERVAL_OPTION |
|
static java.lang.String |
JSON_CONTEXT_OPTION |
|
static java.lang.String |
MAX_INTERVAL_OPTION |
|
static java.lang.String |
MAX_LAZY_TIMEOUT_OPTION |
|
static java.lang.String |
MAX_MESSAGE_SIZE_OPTION |
|
static java.lang.String |
MAX_PROCESSING_OPTION |
|
static java.lang.String |
MAX_QUEUE_OPTION |
|
static java.lang.String |
META_CONNECT_DELIVERY_OPTION |
|
static java.lang.String |
TIMEOUT_OPTION |
Modifier | Constructor | Description |
---|---|---|
protected |
AbstractServerTransport(BayeuxServerImpl bayeux,
java.lang.String name) |
The constructor is passed the
BayeuxServerImpl instance for
the transport. |
Modifier and Type | Method | Description |
---|---|---|
boolean |
allowMessageDeliveryDuringHandshake(ServerSessionImpl session) |
|
void |
destroy() |
|
java.lang.String |
dump() |
|
void |
dump(java.lang.Appendable out,
java.lang.String indent) |
|
BayeuxServerImpl |
getBayeux() |
|
long |
getInterval() |
|
long |
getMaxInterval() |
|
long |
getMaxLazyTimeout() |
|
int |
getMaxMessageSize() |
|
long |
getTimeout() |
|
void |
init() |
Initializes the transport, resolving default and direct options.
|
boolean |
isAllowMessageDeliveryDuringHandshake() |
|
boolean |
isHandshakeReconnect() |
|
boolean |
isMetaConnectDeliveryOnly() |
|
protected org.cometd.bayeux.server.ServerMessage.Mutable[] |
parseMessages(java.io.BufferedReader reader,
boolean jsonDebug) |
|
org.cometd.bayeux.server.ServerMessage.Mutable[] |
parseMessages(java.lang.String json) |
|
void |
processReply(ServerSessionImpl session,
org.cometd.bayeux.server.ServerMessage.Mutable reply,
org.cometd.bayeux.Promise<org.cometd.bayeux.server.ServerMessage.Mutable> promise) |
|
void |
setAllowMessageDeliveryDuringHandshake(boolean allow) |
|
void |
setHandshakeReconnect(boolean handshakeReconnect) |
|
void |
setInterval(long interval) |
|
void |
setMaxInterval(long maxInterval) |
|
void |
setMaxLazyTimeout(long maxLazyTimeout) |
|
void |
setMaxMessageSize(int maxMessageSize) |
|
void |
setMetaConnectDeliveryOnly(boolean meta) |
|
void |
setTimeout(long timeout) |
|
protected void |
sweep() |
Housekeeping sweep, called a regular intervals
|
protected byte[] |
toJSONBytes(org.cometd.bayeux.server.ServerMessage message,
java.lang.String encoding) |
|
java.lang.String |
toString() |
getName, getOption, getOption, getOption, getOption, getOption, getOptionNames, getOptionPrefix, setOption, setOptionPrefix
public static final java.lang.String TIMEOUT_OPTION
public static final java.lang.String INTERVAL_OPTION
public static final java.lang.String MAX_INTERVAL_OPTION
public static final java.lang.String MAX_PROCESSING_OPTION
public static final java.lang.String MAX_LAZY_TIMEOUT_OPTION
public static final java.lang.String META_CONNECT_DELIVERY_OPTION
public static final java.lang.String MAX_QUEUE_OPTION
public static final java.lang.String JSON_CONTEXT_OPTION
public static final java.lang.String HANDSHAKE_RECONNECT_OPTION
public static final java.lang.String ALLOW_MESSAGE_DELIVERY_DURING_HANDSHAKE
public static final java.lang.String MAX_MESSAGE_SIZE_OPTION
protected final org.slf4j.Logger _logger
protected AbstractServerTransport(BayeuxServerImpl bayeux, java.lang.String name)
The constructor is passed the BayeuxServerImpl
instance for
the transport. The BayeuxServerImpl.getOptions()
map is
populated with the default options known by this transport. The options
are then inspected again when init()
is called, to set the
actual values used. The options are arranged into a naming hierarchy
by derived classes adding prefix by calling add AbstractTransport.setOptionPrefix(String)
.
Calls to AbstractTransport.getOption(String)
will use the list of prefixes
to search for the most specific option set.
bayeux
- the BayeuxServer implementationname
- the name of the transportpublic long getInterval()
getInterval
in interface org.cometd.bayeux.server.ServerTransport
public long getMaxInterval()
getMaxInterval
in interface org.cometd.bayeux.server.ServerTransport
public long getMaxLazyTimeout()
getMaxLazyTimeout
in interface org.cometd.bayeux.server.ServerTransport
public long getTimeout()
getTimeout
in interface org.cometd.bayeux.server.ServerTransport
public boolean isMetaConnectDeliveryOnly()
isMetaConnectDeliveryOnly
in interface org.cometd.bayeux.server.ServerTransport
public void setMetaConnectDeliveryOnly(boolean meta)
public boolean isHandshakeReconnect()
public void setHandshakeReconnect(boolean handshakeReconnect)
public boolean isAllowMessageDeliveryDuringHandshake()
public void setAllowMessageDeliveryDuringHandshake(boolean allow)
public int getMaxMessageSize()
public void setMaxMessageSize(int maxMessageSize)
public void init()
public void destroy()
protected org.cometd.bayeux.server.ServerMessage.Mutable[] parseMessages(java.io.BufferedReader reader, boolean jsonDebug) throws java.text.ParseException, java.io.IOException
java.text.ParseException
java.io.IOException
public org.cometd.bayeux.server.ServerMessage.Mutable[] parseMessages(java.lang.String json) throws java.text.ParseException
java.text.ParseException
public BayeuxServerImpl getBayeux()
public void setInterval(long interval)
interval
- the interval in millisecondspublic void setMaxInterval(long maxInterval)
maxInterval
- the maxInterval in millisecondspublic void setTimeout(long timeout)
timeout
- the timeout in millisecondspublic void setMaxLazyTimeout(long maxLazyTimeout)
maxLazyTimeout
- the maxLazyTimeout in millisecondsprotected void sweep()
public void processReply(ServerSessionImpl session, org.cometd.bayeux.server.ServerMessage.Mutable reply, org.cometd.bayeux.Promise<org.cometd.bayeux.server.ServerMessage.Mutable> promise)
protected byte[] toJSONBytes(org.cometd.bayeux.server.ServerMessage message, java.lang.String encoding)
public boolean allowMessageDeliveryDuringHandshake(ServerSessionImpl session)
public java.lang.String dump()
dump
in interface org.eclipse.jetty.util.component.Dumpable
public void dump(java.lang.Appendable out, java.lang.String indent) throws java.io.IOException
dump
in interface org.eclipse.jetty.util.component.Dumpable
java.io.IOException
public java.lang.String toString()
toString
in class java.lang.Object
Copyright © 2008–2017 The CometD Project. All rights reserved.