Class DefaultHttpServer

java.lang.Object
cloud.piranha.http.impl.DefaultHttpServer
All Implemented Interfaces:
HttpServer

public class DefaultHttpServer extends Object implements HttpServer
The default implementation of HTTP Server.
Author:
Manfred Riem ([email protected])
  • Field Details

    • executorService

      protected ExecutorService executorService
      Stores the executor service.
    • processor

      protected HttpServerProcessor processor
      Stores the processor.
    • serverPort

      protected int serverPort
      Stores the port we are listening on.
    • serverAcceptorThread

      protected Thread serverAcceptorThread
      Stores the server acceptor thread.
    • serverSocket

      protected ServerSocket serverSocket
      Stores the server socket.
    • serverStopRequest

      protected boolean serverStopRequest
      Stores the server stop request.
    • soTimeout

      protected int soTimeout
      Stores the SO_TIMEOUT.
    • ssl

      protected boolean ssl
      Stores the SSL flag.
    • threadFactory

      protected ThreadFactory threadFactory
      Stores the thread factory.
  • Constructor Details

    • DefaultHttpServer

      public DefaultHttpServer()
      Constructor
    • DefaultHttpServer

      public DefaultHttpServer(int serverPort)
      Constructor.
      Parameters:
      serverPort - the server port.
    • DefaultHttpServer

      public DefaultHttpServer(int serverPort, HttpServerProcessor processor, boolean ssl)
      Constructor
      Parameters:
      serverPort - the server port.
      processor - the HTTP server processor.
      ssl - the SSL flag.
    • DefaultHttpServer

      public DefaultHttpServer(int serverPort, HttpServerProcessor processor, int soTimeout)
      Constructor
      Parameters:
      serverPort - the server port.
      processor - the HTTP server processor.
      soTimeout - the SO_TIMEOUT.
  • Method Details

    • getSoTimeout

      public int getSoTimeout()
      Returns the SO_TIMEOUT.
      Returns:
      the SO_TIMEOUT
    • isRunning

      public boolean isRunning()
      Description copied from interface: HttpServer
      Check if the server is running.
      Specified by:
      isRunning in interface HttpServer
      Returns:
      true if it is, false otherwise.
      See Also:
      HttpServer.isRunning()
    • start

      public void start()
      Description copied from interface: HttpServer
      Start the server.
      Specified by:
      start in interface HttpServer
      See Also:
      HttpServer.start()
    • stop

      public void stop()
      Description copied from interface: HttpServer
      Stop the server.
      Specified by:
      stop in interface HttpServer
      See Also:
      HttpServer.stop()
    • getServerPort

      public int getServerPort()
      Description copied from interface: HttpServer
      Returns the server port.
      Specified by:
      getServerPort in interface HttpServer
      Returns:
      the server port
    • setServerPort

      public void setServerPort(int serverPort)
      Description copied from interface: HttpServer
      Set the server port
      Specified by:
      setServerPort in interface HttpServer
      Parameters:
      serverPort - the port
    • setSSL

      public void setSSL(boolean ssl)
      Description copied from interface: HttpServer
      Set the SSL flag
      Specified by:
      setSSL in interface HttpServer
      Parameters:
      ssl - the SSL flag
    • getSSL

      public boolean getSSL()
      Description copied from interface: HttpServer
      Get the SSL flag
      Specified by:
      getSSL in interface HttpServer
      Returns:
      the server port
    • setHttpServerProcessor

      public void setHttpServerProcessor(HttpServerProcessor httpServerProcessor)
      Description copied from interface: HttpServer
      Set the http server processor
      Specified by:
      setHttpServerProcessor in interface HttpServer
      Parameters:
      httpServerProcessor - the http server processor
    • getHttpServerProcessor

      public HttpServerProcessor getHttpServerProcessor()
      Description copied from interface: HttpServer
      Returns the http server processor.
      Specified by:
      getHttpServerProcessor in interface HttpServer
      Returns:
      the http server processor