Package io.micronaut.runtime.server
Interface EmbeddedServer
- All Superinterfaces:
ApplicationContextLifeCycle<EmbeddedServer>,ApplicationContextProvider,AutoCloseable,Closeable,EmbeddedApplication<EmbeddedServer>,LifeCycle
- All Known Subinterfaces:
NettyEmbeddedServer
- All Known Implementing Classes:
NettyHttpServer
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 Summary
Modifier and TypeMethodDescriptiondefault URIgetHost()intgetPort()getURI()getURL()default booleanMost servers provide a way to block such that the server doesn't exit, however some require the creation of a keep alive thread.default booleanisServer()This method returns whether the application is a server application or not.Methods inherited from interface io.micronaut.context.ApplicationContextLifeCycle
start, stopMethods inherited from interface io.micronaut.runtime.EmbeddedApplication
getApplicationConfiguration, getApplicationContext, getEnvironment, isForceExit, isShutdownHookNeeded
-
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
- Returns:
- The full URI to the server with the context path
- Since:
- 3.9.1
-
isServer
default boolean isServer()Description copied from interface:EmbeddedApplicationThis 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:
isServerin interfaceEmbeddedApplication<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.
-