Interface EmbeddedServer

All Superinterfaces:
ApplicationContextLifeCycle<EmbeddedServer>, ApplicationContextProvider, AutoCloseable, Closeable, EmbeddedApplication<EmbeddedServer>, LifeCycle
All Known Subinterfaces:
NettyEmbeddedServer
All Known Implementing Classes:
NettyHttpServer

public interface EmbeddedServer extends EmbeddedApplication<EmbeddedServer>

An EmbeddedServer is a general abstraction to manage the lifecycle of any server implementation within a running Micronaut application.

Since:
1.0
Author:
Graeme Rocher
  • Method Details

    • getPort

      int getPort()
      Returns:
      The port exposed by the server
    • getHost

      String getHost()
      Returns:
      The host of the server
    • getScheme

      String getScheme()
      Returns:
      The scheme of the server (http/https)
    • getURL

      URL getURL()
      Returns:
      The full URL to the server
    • getURI

      URI getURI()
      Returns:
      The full URI to the server
    • getContextURI

      default URI getContextURI()
      Returns:
      The full URI to the server with the context path
      Since:
      3.9.1
    • isServer

      default boolean isServer()
      Description copied from interface: EmbeddedApplication
      This method returns whether the application is a server application or not. Server applications require that the thread be kept a live, preventing the application from exiting.
      Specified by:
      isServer in interface EmbeddedApplication<EmbeddedServer>
      Returns:
      True if the application is a server
    • isKeepAlive

      default boolean isKeepAlive()
      Most servers provide a way to block such that the server doesn't exit, however some require the creation of a keep alive thread.
      Returns:
      True if the server should be kept alive.