Class UndertowServer
java.lang.Object
io.micronaut.servlet.http.server.AbstractServletServer<io.undertow.Undertow>
io.micronaut.servlet.undertow.UndertowServer
- All Implemented Interfaces:
io.micronaut.context.ApplicationContextLifeCycle<io.micronaut.runtime.server.EmbeddedServer>, io.micronaut.context.ApplicationContextProvider, io.micronaut.context.LifeCycle<io.micronaut.runtime.server.EmbeddedServer>, io.micronaut.runtime.EmbeddedApplication<io.micronaut.runtime.server.EmbeddedServer>, io.micronaut.runtime.graceful.GracefulShutdownCapable, io.micronaut.runtime.server.EmbeddedServer, Closeable, AutoCloseable
Implementation of
AbstractServletServer for Undertow.- Since:
- 1.0.0
- Author:
- graemerocher
-
Constructor Summary
ConstructorsConstructorDescriptionUndertowServer(io.micronaut.context.ApplicationContext applicationContext, io.micronaut.runtime.ApplicationConfiguration applicationConfiguration, @Nullable io.micronaut.context.event.ApplicationEventPublisher<io.micronaut.runtime.server.event.ServerShutdownEvent> serverShutdownEventPublisher, io.undertow.Undertow undertow) Default constructor.UndertowServer(io.micronaut.context.ApplicationContext applicationContext, io.micronaut.runtime.ApplicationConfiguration applicationConfiguration, io.undertow.Undertow undertow) Deprecated, for removal: This API element is subject to removal in a future version. -
Method Summary
Modifier and TypeMethodDescriptiongetHost()intgetPort()getURI()getURL()booleanWaits for the requests the handler counted, and then for Undertow's own exchanges: the handler is done once the response has been handed to the container, but Undertow ends an exchange on its IO thread afterwards, and stopping the server before that drops a response that was written but not yet flushed (seen withConnection: closerequests).protected voidStart the server.protected voidMakes the server answer new requests with503 Service Unavailablewhile requests already in progress complete.protected voidStop the server.Methods inherited from class AbstractServletServer
getApplicationConfiguration, getApplicationContext, getServer, reportActiveTasks, start, stopMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface io.micronaut.runtime.EmbeddedApplication
getEnvironment, isForceExit, isShutdownHookNeededMethods inherited from interface io.micronaut.runtime.server.EmbeddedServer
getContextURI, isKeepAlive, isServerMethods inherited from interface io.micronaut.context.LifeCycle
close, refresh
-
Constructor Details
-
UndertowServer
@Inject public UndertowServer(io.micronaut.context.ApplicationContext applicationContext, io.micronaut.runtime.ApplicationConfiguration applicationConfiguration, @Nullable io.micronaut.context.event.ApplicationEventPublisher<io.micronaut.runtime.server.event.ServerShutdownEvent> serverShutdownEventPublisher, io.undertow.Undertow undertow) Default constructor.- Parameters:
applicationContext- The app contextapplicationConfiguration- The app configserverShutdownEventPublisher-ApplicationEventPublisherfor theServerShutdownEventevent.undertow- The undertow instance
-
UndertowServer
@Deprecated(forRemoval=true, since="5.2.0") public UndertowServer(io.micronaut.context.ApplicationContext applicationContext, io.micronaut.runtime.ApplicationConfiguration applicationConfiguration, io.undertow.Undertow undertow) Deprecated, for removal: This API element is subject to removal in a future version.Default constructor.- Parameters:
applicationContext- The app contextapplicationConfiguration- The app configundertow- The undertow instance
-
-
Method Details
-
startServer
Description copied from class:AbstractServletServerStart the server.- Specified by:
startServerin classAbstractServletServer<io.undertow.Undertow>- Throws:
Exception- when an error occurred starting the server
-
stopServer
Description copied from class:AbstractServletServerStop the server.- Specified by:
stopServerin classAbstractServletServer<io.undertow.Undertow>- Throws:
Exception- when an error occurred stopping the server
-
stopAcceptingRequests
protected void stopAcceptingRequests()Makes the server answer new requests with503 Service Unavailablewhile requests already in progress complete. Undertow's own listener suspension is not used because it closes every connection, including those with a request in flight.- Overrides:
stopAcceptingRequestsin classAbstractServletServer<io.undertow.Undertow>
-
shutdownGracefully
Waits for the requests the handler counted, and then for Undertow's own exchanges: the handler is done once the response has been handed to the container, but Undertow ends an exchange on its IO thread afterwards, and stopping the server before that drops a response that was written but not yet flushed (seen withConnection: closerequests).- Specified by:
shutdownGracefullyin interfaceio.micronaut.runtime.graceful.GracefulShutdownCapable- Overrides:
shutdownGracefullyin classAbstractServletServer<io.undertow.Undertow>- Returns:
- A stage that completes when no request is active
-
getPort
public int getPort() -
getHost
-
getScheme
-
getURL
-
getURI
-
isRunning
public boolean isRunning()
-
UndertowServer(ApplicationContext, ApplicationConfiguration, ApplicationEventPublisher, Undertow)instead