Class HttpServer

java.lang.Object
org.nanonative.nano.core.model.Service
org.nanonative.nano.services.http.HttpServer

public class HttpServer extends Service
  • Field Details

    • server

      protected HttpServer server
    • CONFIG_SERVICE_HTTP_PORT

      public static final String CONFIG_SERVICE_HTTP_PORT
    • CONFIG_SERVICE_HTTP_CLIENT

      public static final String CONFIG_SERVICE_HTTP_CLIENT
    • EVENT_HTTP_REQUEST

      public static final int EVENT_HTTP_REQUEST
    • EVENT_HTTP_REQUEST_UNHANDLED

      public static final int EVENT_HTTP_REQUEST_UNHANDLED
    • STARTUP_LOCK

      protected static final Lock STARTUP_LOCK
  • Constructor Details

    • HttpServer

      public HttpServer()
  • Method Details

    • address

      public InetSocketAddress address()
    • port

      public int port()
    • server

      public HttpServer server()
    • stop

      public void stop()
      Specified by:
      stop in class Service
    • start

      public void start()
      Specified by:
      start in class Service
    • onEvent

      public void onEvent(Event event)
      Specified by:
      onEvent in class Service
    • configure

      public void configure(berlin.yuna.typemap.model.TypeMapI<?> configs, berlin.yuna.typemap.model.TypeMapI<?> merged)
      Specified by:
      configure in class Service
    • onFailure

      public Object onFailure(Event error)
      Specified by:
      onFailure in class Service
    • sendResponse

      protected void sendResponse(HttpExchange exchange, HttpObject request, HttpObject response)
    • encodeBody

      protected byte[] encodeBody(byte[] body, String contentEncoding)
    • nextFreePort

      public static int nextFreePort(int startPort)
    • isPortInUse

      public static boolean isPortInUse(int portNumber)
    • setError

      public static Consumer<Event> setError(AtomicBoolean internalError)