Class ServerInstance

java.lang.Object
net.uiqui.embedhttp.server.ServerInstance
All Implemented Interfaces:
HttpServer

public class ServerInstance extends Object implements HttpServer
  • Field Details

  • Constructor Details

    • ServerInstance

      public ServerInstance(int port, int backlog)
  • Method Details

    • start

      public boolean start(Router router) throws InterruptedException
      Description copied from interface: HttpServer
      Starts the HTTP server with the specified router.
      Specified by:
      start in interface HttpServer
      Parameters:
      router - The router to handle incoming requests.
      Returns:
      true if the server started successfully, false otherwise.
      Throws:
      InterruptedException - If an error occurs while starting the server.
    • stop

      public boolean stop() throws InterruptedException
      Description copied from interface: HttpServer
      Stops the HTTP server.
      Specified by:
      stop in interface HttpServer
      Returns:
      true if the server stopped successfully, false otherwise.
      Throws:
      InterruptedException - If an error occurs while stopping the server.
    • isRunning

      public boolean isRunning()
      Description copied from interface: HttpServer
      Checks if the server is currently running.
      Specified by:
      isRunning in interface HttpServer
      Returns:
      true if the server is running, false otherwise.
    • getInstancePort

      public int getInstancePort()
      Description copied from interface: HttpServer
      Retrieves the port on which the server is running.
      Specified by:
      getInstancePort in interface HttpServer
      Returns:
      The port number.