Package org.cometd.oort
Class OortConfigServlet
java.lang.Object
jakarta.servlet.GenericServlet
jakarta.servlet.http.HttpServlet
org.cometd.oort.OortConfigServlet
- All Implemented Interfaces:
jakarta.servlet.Servlet,jakarta.servlet.ServletConfig,Serializable
- Direct Known Subclasses:
OortMulticastConfigServlet,OortStaticConfigServlet
public abstract class OortConfigServlet
extends jakarta.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:
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract voidconfigureCloud(jakarta.servlet.ServletConfig config, Oort oort) Configures the Oort cloud by establishing connections with other Oort comets.protected voidconfigureOort(jakarta.servlet.ServletConfig config, Oort oort) Configures the Oort instance with servlet init parameters.voiddestroy()voidinit(jakarta.servlet.ServletConfig config) protected OortCreates and returns a new Oort instance.protected StringRetrieves theoort.urlparameter from this servlet init parameters.Methods inherited from class jakarta.servlet.http.HttpServlet
doDelete, doGet, doHead, doOptions, doPost, doPut, doTrace, getLastModified, service, serviceMethods inherited from class jakarta.servlet.GenericServlet
getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, init, log, log
-
Field Details
-
OORT_URL_PARAM
- See Also:
-
OORT_SECRET_PARAM
- See Also:
-
OORT_CHANNELS_PARAM
- See Also:
-
OORT_ENABLE_ACK_EXTENSION_PARAM
- See Also:
-
OORT_ENABLE_BINARY_EXTENSION_PARAM
- See Also:
-
OORT_JSON_CONTEXT_PARAM
- See Also:
-
OORT_CLIENT_TRANSPORT_FACTORIES_PARAM
- See Also:
-
-
Constructor Details
-
OortConfigServlet
public OortConfigServlet()
-
-
Method Details
-
init
public void init(jakarta.servlet.ServletConfig config) throws jakarta.servlet.ServletException - Specified by:
initin interfacejakarta.servlet.Servlet- Overrides:
initin classjakarta.servlet.GenericServlet- Throws:
jakarta.servlet.ServletException
-
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
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
Configures the Oort instance with servlet init parameters.
- Parameters:
config- the Servlet configurationoort- the Oort instance to configure- Throws:
Exception- if the Oort instance cannot be configured
-
configureCloud
protected abstract void configureCloud(jakarta.servlet.ServletConfig config, Oort oort) throws Exception Configures 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:
destroyin interfacejakarta.servlet.Servlet- Overrides:
destroyin classjakarta.servlet.GenericServlet
-