Package org.cometd.oort
Class OortConfigServlet
java.lang.Object
javax.servlet.GenericServlet
javax.servlet.http.HttpServlet
org.cometd.oort.OortConfigServlet
- All Implemented Interfaces:
Serializable
,javax.servlet.Servlet
,javax.servlet.ServletConfig
- Direct Known Subclasses:
OortMulticastConfigServlet
,OortStaticConfigServlet
public abstract class OortConfigServlet
extends javax.servlet.http.HttpServlet
This servlet serves as a base class for initializing and configuring an
instance of the Oort
CometD cluster manager.
The following servlet init parameters are used to configure the Oort instance:
oort.url
, the absolute public URL to the CometD servletoort.secret
, the pre-shared secret that Oort servers use to authenticate connections from other Oort cometsoort.channels
, a comma separated list of channels that will be passed toOort.observeChannel(String)
clientDebug
, a boolean that enables debugging of the clients connected to other oort cluster managers
Override method newOort(BayeuxServer, String)
to return a customized
instance of Oort
.
- See Also:
SetiServlet
, Serialized Form
-
Field Summary
Fields Modifier and Type Field Description protected static org.slf4j.Logger
LOG
static String
OORT_CHANNELS_PARAM
static String
OORT_ENABLE_ACK_EXTENSION_PARAM
static String
OORT_ENABLE_BINARY_EXTENSION_PARAM
static String
OORT_JSON_CONTEXT_PARAM
static String
OORT_SECRET_PARAM
static String
OORT_URL_PARAM
-
Constructor Summary
Constructors Constructor Description OortConfigServlet()
-
Method Summary
Modifier and Type Method Description protected abstract void
configureCloud(javax.servlet.ServletConfig config, Oort oort)
Configures the Oort cloud by establishing connections with other Oort comets.void
destroy()
void
init(javax.servlet.ServletConfig config)
protected Oort
newOort(BayeuxServer bayeux, String url)
Creates and returns a new Oort instance.protected String
provideOortURL()
Retrieves theoort.url
parameter from this servlet init parameters.Methods inherited from class javax.servlet.http.HttpServlet
doDelete, doGet, doHead, doOptions, doPost, doPut, doTrace, getLastModified, service, service
-
Field Details
-
OORT_URL_PARAM
- See Also:
- Constant Field Values
-
OORT_SECRET_PARAM
- See Also:
- Constant Field Values
-
OORT_CHANNELS_PARAM
- See Also:
- Constant Field Values
-
OORT_ENABLE_ACK_EXTENSION_PARAM
- See Also:
- Constant Field Values
-
OORT_ENABLE_BINARY_EXTENSION_PARAM
- See Also:
- Constant Field Values
-
OORT_JSON_CONTEXT_PARAM
- See Also:
- Constant Field Values
-
LOG
protected static final org.slf4j.Logger LOG
-
-
Constructor Details
-
OortConfigServlet
public OortConfigServlet()
-
-
Method Details
-
init
public void init(javax.servlet.ServletConfig config) throws javax.servlet.ServletException- Specified by:
init
in interfacejavax.servlet.Servlet
- Overrides:
init
in classjavax.servlet.GenericServlet
- Throws:
javax.servlet.ServletException
-
provideOortURL
Retrieves the
oort.url
parameter from this servlet init parameters.Subclasses can override this method to compute the
oort.url
parameter dynamically, for example by retrieving the IP address of the host.- Returns:
- the
oort.url
parameter
-
newOort
Creates and returns a new Oort instance.
- Parameters:
bayeux
- the BayeuxServer instance to which the Oort instance should be associated tourl
- theoort.url
of the Oort instance- Returns:
- a new Oort instance
-
configureCloud
protected abstract void configureCloud(javax.servlet.ServletConfig config, Oort oort) throws ExceptionConfigures the Oort cloud by establishing connections with other Oort comets.
Subclasses implement their own strategy to discover and link with other comets.
- Parameters:
config
- the servlet configuration to read parameters fromoort
- the Oort instance associated with this configuration servlet- Throws:
Exception
- if the cloud configuration fails
-
destroy
public void destroy()- Specified by:
destroy
in interfacejavax.servlet.Servlet
- Overrides:
destroy
in classjavax.servlet.GenericServlet
-