Bayeuxpublic interface BayeuxServer extends Bayeux
The server-side Bayeux interface.
An instance of the BayeuxServer interface is available to
web applications via the "" attribute
of the javax.servlet.ServletContext.
The BayeuxServer APIs give access to the
ServerSessions via the getSession(String)
method. It also allows new LocalSession to be
created within the server using the newLocalSession(String)
method.
ServerChannel instances may be accessed via the
getChannel(String) method, but the server has
no direct relationship with ClientSessionChannels or
ClientSession.
If subscription semantics is required, then
the newLocalSession(String) method should be used to
create a LocalSession that can subscribe and publish
like a client-side Bayeux session.
| Modifier and Type | Interface | Description |
|---|---|---|
static interface |
BayeuxServer.BayeuxServerListener |
Common base interface for all server-side Bayeux listeners.
|
static interface |
BayeuxServer.ChannelListener |
Specialized listener for
ServerChannel events. |
static interface |
BayeuxServer.Extension |
Extension API for
BayeuxServer. |
static interface |
BayeuxServer.SessionListener |
Specialized listener for
ServerSession events. |
static interface |
BayeuxServer.SubscriptionListener |
Specialized listener for
ServerChannel subscription events. |
Bayeux.BayeuxListener| Modifier and Type | Field | Description |
|---|---|---|
static String |
ATTRIBUTE |
ServletContext attribute name used to obtain the Bayeux object
|
getAllowedTransports, getKnownTransportNames, getOption, getOptionNames, getTransport, setOptionstatic final String ATTRIBUTE
void addExtension(BayeuxServer.Extension extension)
Adds the given extension to this Bayeux object.
extension - the extension to addremoveExtension(Extension)void removeExtension(BayeuxServer.Extension extension)
Removes the given extension from this Bayeux object.
extension - the extension to removeaddExtension(Extension)List<BayeuxServer.Extension> getExtensions()
addExtension(Extension)void addListener(BayeuxServer.BayeuxServerListener listener)
Adds a listener to this Bayeux object.
listener - the listener to addremoveListener(BayeuxServerListener)void removeListener(BayeuxServer.BayeuxServerListener listener)
Removes a listener from this Bayeux object.
listener - the listener to removeaddListener(BayeuxServerListener)ServerChannel getChannel(String channelId)
channelId - the channel identifierServerChannel with the given channelId,
or null if no such channel existscreateChannelIfAbsent(String, ConfigurableServerChannel.Initializer...)List<ServerChannel> getChannels()
MarkedReference<ServerChannel> createChannelIfAbsent(String channelName, ConfigurableServerChannel.Initializer... initializers)
Creates a ServerChannel and initializes it atomically if the
channel does not exist, or returns it if it already exists.
This method can be used instead of adding a BayeuxServer.ChannelListener
to atomically initialize a channel. The initializers will be
called before any other thread can access the new channel instance.
This method should be used when a channel needs to be initialized (e.g. by adding listeners) before any publish or subscribes can occur on the channel, or before any other thread may concurrently create the same channel.
channelName - the channel nameinitializers - the initializers invoked to configure the channelMarkedReference whose reference is the channel, and
the mark signals whether the channel has been created because it
did not exist before.ServerSession getSession(String clientId)
clientId - the ServerSession identifierServerSession with the given clientId
or null if no such valid session exists.List<ServerSession> getSessions()
ServerSessions known to this BayeuxServer objectboolean removeSession(ServerSession session)
Removes the given session from this BayeuxServer.
This method triggers the invocation of all listeners that would be called if the session was disconnected or if the session timed out.
session - the session to removeLocalSession newLocalSession(String idHint)
Creates a new LocalSession.
A LocalSession is a server-side ClientSession that allows
server-side code to have special clients (resident within the same JVM)
that can be used to publish and subscribe like a client-side session
would do.
idHint - a hint to be included in the unique clientId of the session.LocalSessionServerMessage.Mutable newMessage()
SecurityPolicy getSecurityPolicy()
SecurityPolicy associated with this sessionsetSecurityPolicy(SecurityPolicy)void setSecurityPolicy(SecurityPolicy securityPolicy)
securityPolicy - the SecurityPolicy associated with this sessiongetSecurityPolicy()Transport getCurrentTransport()
BayeuxContext getContext()
getCurrentTransport()).ServerTransport.getContext()Copyright © 2008–2017 The CometD Project. All rights reserved.