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 servlet
  • oort.secret, the pre-shared secret that Oort servers use to authenticate connections from other Oort comets
  • oort.channels, a comma separated list of channels that will be passed to Oort.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 Details

  • Constructor Details

    • OortConfigServlet

      public OortConfigServlet()
  • Method Details

    • init

      public void init(jakarta.servlet.ServletConfig config) throws jakarta.servlet.ServletException
      Specified by:
      init in interface jakarta.servlet.Servlet
      Overrides:
      init in class jakarta.servlet.GenericServlet
      Throws:
      jakarta.servlet.ServletException
    • provideOortURL

      protected String 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

      protected Oort newOort(BayeuxServer bayeux, String url)

      Creates and returns a new Oort instance.

      Parameters:
      bayeux - the BayeuxServer instance to which the Oort instance should be associated to
      url - the oort.url of the Oort instance
      Returns:
      a new Oort instance
    • configureOort

      protected void configureOort(jakarta.servlet.ServletConfig config, Oort oort) throws Exception

      Configures the Oort instance with servlet init parameters.

      Parameters:
      config - the Servlet configuration
      oort - 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 from
      oort - the Oort instance associated with this configuration servlet
      Throws:
      Exception - if the cloud configuration fails
    • destroy

      public void destroy()
      Specified by:
      destroy in interface jakarta.servlet.Servlet
      Overrides:
      destroy in class jakarta.servlet.GenericServlet