Class AbstractHttpTransport
java.lang.Object
org.cometd.common.AbstractTransport
org.cometd.server.AbstractServerTransport
org.cometd.server.http.AbstractHttpTransport
- All Implemented Interfaces:
ServerTransport
,Transport
,org.eclipse.jetty.util.component.Dumpable
- Direct Known Subclasses:
JSONHttpTransport
,JSONPHttpTransport
HTTP ServerTransport base class, used by ServerTransports that use HTTP as transport or to initiate a transport connection.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic interface
AAbstractServerTransport.Scheduler
for HTTP-based transports.protected class
Nested classes/interfaces inherited from class org.cometd.server.AbstractServerTransport
AbstractServerTransport.Scheduler
Nested classes/interfaces inherited from interface org.eclipse.jetty.util.component.Dumpable
org.eclipse.jetty.util.component.Dumpable.DumpableContainer
-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
Fields inherited from class org.cometd.server.AbstractServerTransport
ALLOW_MESSAGE_DELIVERY_DURING_HANDSHAKE, HANDSHAKE_RECONNECT_OPTION, INTERVAL_OPTION, JSON_CONTEXT_OPTION, MAX_INTERVAL_OPTION, MAX_LAZY_TIMEOUT_OPTION, MAX_MESSAGE_SIZE_OPTION, MAX_PROCESSING_OPTION, MAX_QUEUE_OPTION, META_CONNECT_DELIVERY_OPTION, TIMEOUT_OPTION
Fields inherited from interface org.eclipse.jetty.util.component.Dumpable
KEY
-
Constructor Summary
ModifierConstructorDescriptionprotected
AbstractHttpTransport
(BayeuxServerImpl bayeux, String name) -
Method Summary
Modifier and TypeMethodDescriptionabstract boolean
accept
(CometDRequest request) void
decBrowserId
(ServerSessionImpl session, boolean http2) static AbstractHttpTransport
find
(BayeuxServer bayeuxServer, CometDRequest request) protected String
findBrowserId
(TransportContext context) protected Collection
<ServerSessionImpl> findCurrentSessions
(CometDRequest request) protected ServerSessionImpl
findSession
(Collection<ServerSessionImpl> sessions, ServerMessage.Mutable message) protected void
flush
(TransportContext context) protected String
protected int
protected String
protected String
protected String
protected int
protected long
void
handle
(BayeuxContext bayeuxContext, CometDRequest request, CometDResponse response, Promise<Void> promise) protected abstract void
handle
(TransportContext context) protected void
handleMessage
(TransportContext context, ServerMessage.Mutable message, Promise<ServerMessage.Mutable> promise) boolean
incBrowserId
(ServerSessionImpl session, boolean http2) Increments the count of sessions for the given browser identifier.void
init()
Initializes the transport, resolving default and direct options.protected boolean
protected boolean
protected boolean
protected boolean
isHTTP2
(CometDRequest request) protected void
newBrowserCookie
(StringBuilder builder, String name, String value, boolean secure) protected AbstractHttpTransport.HttpScheduler
newHttpScheduler
(TransportContext context, Promise<Void> promise, ServerMessage.Mutable reply, long timeout) protected void
processMessages
(TransportContext context, List<ServerMessage.Mutable> messages) protected void
resume
(TransportContext context, ServerMessage.Mutable message, Promise<Void> promise) protected String
setBrowserId
(TransportContext context) protected AbstractHttpTransport.HttpScheduler
suspend
(TransportContext context, Promise<Void> promise, ServerMessage.Mutable message, long timeout) protected void
sweep()
Sweeps the transport for old Browser IDsprotected byte[]
toJSONBytes
(ServerMessage msg) protected void
write
(TransportContext context, List<ServerMessage> messages) protected void
writeBegin
(CometDResponse.Output output, Promise<Void> promise) protected void
writeComplete
(TransportContext context, List<ServerMessage> messages) protected void
writeEnd
(CometDResponse.Output output, Promise<Void> promise) protected void
writeMessage
(CometDResponse.Output output, ServerMessage message, Promise<Void> promise) protected void
writePrepare
(TransportContext context, Promise<Void> promise) Methods inherited from class org.cometd.server.AbstractServerTransport
allowMessageDeliveryDuringHandshake, destroy, dump, getBayeuxServer, getInterval, getJSONContextServer, getMaxInterval, getMaxLazyTimeout, getMaxMessageSize, getTimeout, isAllowMessageDeliveryDuringHandshake, isHandshakeReconnect, isMetaConnectDeliveryOnly, newMetaConnectCycle, parseMessages, processReply, scheduleExpiration, setAllowMessageDeliveryDuringHandshake, setHandshakeReconnect, setInterval, setMaxInterval, setMaxLazyTimeout, setMaxMessageSize, setMetaConnectDeliveryOnly, setTimeout, toJSON, toString
Methods inherited from class org.cometd.common.AbstractTransport
getName, getOption, getOption, getOption, getOption, getOption, getOptionNames, getOptionPrefix, setOption, setOptionPrefix
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.eclipse.jetty.util.component.Dumpable
dump, dumpSelf
Methods inherited from interface org.cometd.bayeux.Transport
getName, getOption, getOptionNames, getOptionPrefix
-
Field Details
-
PREFIX
- See Also:
-
JSON_DEBUG_OPTION
- See Also:
-
MESSAGE_PARAM
- See Also:
-
BROWSER_COOKIE_NAME_OPTION
- See Also:
-
BROWSER_COOKIE_DOMAIN_OPTION
- See Also:
-
BROWSER_COOKIE_PATH_OPTION
- See Also:
-
BROWSER_COOKIE_MAX_AGE_OPTION
- See Also:
-
BROWSER_COOKIE_SECURE_OPTION
- See Also:
-
BROWSER_COOKIE_HTTP_ONLY_OPTION
- See Also:
-
BROWSER_COOKIE_SAME_SITE_OPTION
- See Also:
-
BROWSER_COOKIE_PARTITIONED_OPTION
- See Also:
-
MAX_SESSIONS_PER_BROWSER_OPTION
- See Also:
-
HTTP2_MAX_SESSIONS_PER_BROWSER_OPTION
- See Also:
-
MULTI_SESSION_INTERVAL_OPTION
- See Also:
-
TRUST_CLIENT_SESSION_OPTION
- See Also:
-
DUPLICATE_META_CONNECT_HTTP_RESPONSE_CODE_OPTION
- See Also:
-
-
Constructor Details
-
AbstractHttpTransport
-
-
Method Details
-
find
-
init
public void init()Description copied from class:AbstractServerTransport
Initializes the transport, resolving default and direct options.- Overrides:
init
in classAbstractServerTransport
-
getBrowserCookieName
-
getBrowserCookieDomain
-
getBrowserCookiePath
-
getBrowserCookieMaxAge
protected int getBrowserCookieMaxAge() -
isBrowserCookieSecure
protected boolean isBrowserCookieSecure() -
isBrowserCookieHttpOnly
protected boolean isBrowserCookieHttpOnly() -
getBrowserCookieSameSite
-
isBrowserCookiePartitioned
protected boolean isBrowserCookiePartitioned() -
getMultiSessionInterval
protected long getMultiSessionInterval() -
getDuplicateMetaConnectHttpResponseCode
protected int getDuplicateMetaConnectHttpResponseCode() -
accept
-
handle
public void handle(BayeuxContext bayeuxContext, CometDRequest request, CometDResponse response, Promise<Void> promise) -
handle
-
suspend
protected AbstractHttpTransport.HttpScheduler suspend(TransportContext context, Promise<Void> promise, ServerMessage.Mutable message, long timeout) -
newHttpScheduler
protected AbstractHttpTransport.HttpScheduler newHttpScheduler(TransportContext context, Promise<Void> promise, ServerMessage.Mutable reply, long timeout) -
write
-
processMessages
-
findSession
protected ServerSessionImpl findSession(Collection<ServerSessionImpl> sessions, ServerMessage.Mutable message) -
findCurrentSessions
-
isHTTP2
-
flush
-
resume
protected void resume(TransportContext context, ServerMessage.Mutable message, Promise<Void> promise) -
findBrowserId
-
setBrowserId
-
newBrowserCookie
-
incBrowserId
Increments the count of sessions for the given browser identifier.- Parameters:
session
- the session that increments the counthttp2
- whether the HTTP protocol is HTTP/2- Returns:
- true if the count is below the max sessions per browser value. If false is returned, the count is not incremented.
- See Also:
-
decBrowserId
-
handleMessage
protected void handleMessage(TransportContext context, ServerMessage.Mutable message, Promise<ServerMessage.Mutable> promise) -
writePrepare
-
writeBegin
-
writeMessage
protected void writeMessage(CometDResponse.Output output, ServerMessage message, Promise<Void> promise) -
writeEnd
-
writeComplete
-
sweep
protected void sweep()Sweeps the transport for old Browser IDs- Overrides:
sweep
in classAbstractServerTransport
-
toJSONBytes
-