All Implemented Interfaces:
Serializable, Cloneable, Iterable<HTTPServer>, Collection<HTTPServer>, List<HTTPServer>, RandomAccess, SequencedCollection<HTTPServer>

public class HTTPServerListextends Vector<HTTPServer>
A collection of HTTPServer instances that extends Vector. This class manages multiple HTTP servers, allowing them to be started, stopped, and configured as a group.
See Also:
  • Field Details

    • binds

      private InetAddress[] binds
      Local addresses the servers are opened on, or null to bind all interfaces.
    • port

      private int port
      Port each server is opened on.
  • Constructor Details

    • HTTPServerList

      public HTTPServerList()
      Creates a new empty HTTPServerList.
    • HTTPServerList

      public HTTPServerList(InetAddress[] list, int port)
      Creates a new HTTPServerList with specified bind addresses and port.
      Parameters:
      list - array of InetAddress objects to bind to
      port - the port number for all servers
  • Method Details

    • addRequestListener

      public void addRequestListener(HTTPRequestListener listener)
      Adds a request listener to all HTTP servers in this list.
      Parameters:
      listener - the request listener to add
    • getHTTPServer

      public HTTPServer getHTTPServer(int n)
      Gets the HTTPServer at the specified index.
      Parameters:
      n - the index of the server to retrieve
      Returns:
      the HTTPServer at the specified index
    • close

      public void close()
      Closes all HTTP servers in this list.
    • open

      public int open()
      Opens HTTP servers on all configured bind addresses. If no bind addresses are specified, uses I2P local addresses.
      Returns:
      the number of successfully opened servers
    • open

      public boolean open(int port)
      Opens HTTP servers on the specified port.
      Parameters:
      port - the port number to use
      Returns:
      true if at least one server was opened successfully
    • start

      public void start()
      Starts all HTTP servers in this list.
    • stop

      public void stop()
      Stops all HTTP servers in this list.