Interface EmbeddedServer

  • All Superinterfaces:
    io.micronaut.context.ApplicationContextLifeCycle<EmbeddedServer>, io.micronaut.context.ApplicationContextProvider, java.lang.AutoCloseable, java.io.Closeable, EmbeddedApplication<EmbeddedServer>, io.micronaut.context.LifeCycle

    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
    • Method Detail

      • getPort

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

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

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

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

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

        default java.net.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.