Package org.cometd.oort
Class OortConfigServlet
- java.lang.Object
-
- javax.servlet.GenericServlet
-
- javax.servlet.http.HttpServlet
-
- org.cometd.oort.OortConfigServlet
-
- All Implemented Interfaces:
java.io.Serializable,javax.servlet.Servlet,javax.servlet.ServletConfig
- Direct Known Subclasses:
OortMulticastConfigServlet,OortStaticConfigServlet
public abstract class OortConfigServlet extends javax.servlet.http.HttpServletThis servlet serves as a base class for initializing and configuring an instance of the
OortCometD 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 ofOort.- See Also:
SetiServlet, Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringOORT_CHANNELS_PARAMstatic java.lang.StringOORT_CLIENT_TRANSPORT_FACTORIES_PARAMstatic java.lang.StringOORT_ENABLE_ACK_EXTENSION_PARAMstatic java.lang.StringOORT_ENABLE_BINARY_EXTENSION_PARAMstatic java.lang.StringOORT_JSON_CONTEXT_PARAMstatic java.lang.StringOORT_SECRET_PARAMstatic java.lang.StringOORT_URL_PARAM
-
Constructor Summary
Constructors Constructor Description OortConfigServlet()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract voidconfigureCloud(javax.servlet.ServletConfig config, Oort oort)Configures the Oort cloud by establishing connections with other Oort comets.protected voidconfigureOort(javax.servlet.ServletConfig config, Oort oort)Configures the Oort instance with servlet init parameters.voiddestroy()voidinit(javax.servlet.ServletConfig config)protected OortnewOort(BayeuxServer bayeux, java.lang.String url)Creates and returns a new Oort instance.protected java.lang.StringprovideOortURL()Retrieves theoort.urlparameter from this servlet init parameters.-
Methods inherited from class javax.servlet.http.HttpServlet
doDelete, doGet, doHead, doOptions, doPost, doPut, doTrace, getLastModified, service, service
-
-
-
-
Field Detail
-
OORT_URL_PARAM
public static final java.lang.String OORT_URL_PARAM
- See Also:
- Constant Field Values
-
OORT_SECRET_PARAM
public static final java.lang.String OORT_SECRET_PARAM
- See Also:
- Constant Field Values
-
OORT_CHANNELS_PARAM
public static final java.lang.String OORT_CHANNELS_PARAM
- See Also:
- Constant Field Values
-
OORT_ENABLE_ACK_EXTENSION_PARAM
public static final java.lang.String OORT_ENABLE_ACK_EXTENSION_PARAM
- See Also:
- Constant Field Values
-
OORT_ENABLE_BINARY_EXTENSION_PARAM
public static final java.lang.String OORT_ENABLE_BINARY_EXTENSION_PARAM
- See Also:
- Constant Field Values
-
OORT_JSON_CONTEXT_PARAM
public static final java.lang.String OORT_JSON_CONTEXT_PARAM
- See Also:
- Constant Field Values
-
OORT_CLIENT_TRANSPORT_FACTORIES_PARAM
public static final java.lang.String OORT_CLIENT_TRANSPORT_FACTORIES_PARAM
- See Also:
- Constant Field Values
-
-
Method Detail
-
init
public void init(javax.servlet.ServletConfig config) throws javax.servlet.ServletException- Specified by:
initin interfacejavax.servlet.Servlet- Overrides:
initin classjavax.servlet.GenericServlet- Throws:
javax.servlet.ServletException
-
provideOortURL
protected java.lang.String provideOortURL()
Retrieves the
oort.urlparameter from this servlet init parameters.Subclasses can override this method to compute the
oort.urlparameter dynamically, for example by retrieving the IP address of the host.- Returns:
- the
oort.urlparameter
-
newOort
protected Oort newOort(BayeuxServer bayeux, java.lang.String url)
Creates and returns a new Oort instance.
- Parameters:
bayeux- the BayeuxServer instance to which the Oort instance should be associated tourl- theoort.urlof the Oort instance- Returns:
- a new Oort instance
-
configureOort
protected void configureOort(javax.servlet.ServletConfig config, Oort oort) throws java.lang.ExceptionConfigures the Oort instance with servlet init parameters.
- Parameters:
config- the Servlet configurationoort- the Oort instance to configure- Throws:
java.lang.Exception- if the Oort instance cannot be configured
-
configureCloud
protected abstract void configureCloud(javax.servlet.ServletConfig config, Oort oort) throws java.lang.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:
java.lang.Exception- if the cloud configuration fails
-
destroy
public void destroy()
- Specified by:
destroyin interfacejavax.servlet.Servlet- Overrides:
destroyin classjavax.servlet.GenericServlet
-
-