Class NettyWebServer
java.lang.Object
org.springframework.boot.reactor.netty.NettyWebServer
- All Implemented Interfaces:
org.springframework.boot.web.server.WebServer
WebServer that can be used to control a Reactor Netty web server. Usually this
class should be created using the NettyReactiveWebServerFactory and not
directly.- Since:
- 4.0.0
-
Constructor Summary
ConstructorsConstructorDescriptionNettyWebServer(reactor.netty.http.server.HttpServer httpServer, org.springframework.http.server.reactive.ReactorHttpHandlerAdapter handlerAdapter, @Nullable Duration lifecycleTimeout, @Nullable org.springframework.boot.web.server.Shutdown shutdown, @Nullable org.springframework.http.client.ReactorResourceFactory resourceFactory) Creates a newNettyWebServerinstance. -
Method Summary
Modifier and TypeMethodDescriptionintgetPort()protected StringvoidsetRouteProviders(List<NettyRouteProvider> routeProviders) voidshutDownGracefully(org.springframework.boot.web.server.GracefulShutdownCallback callback) Initiates a graceful shutdown of the Netty web server.voidstart()voidstop()Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.springframework.boot.web.server.WebServer
destroy
-
Constructor Details
-
NettyWebServer
public NettyWebServer(reactor.netty.http.server.HttpServer httpServer, org.springframework.http.server.reactive.ReactorHttpHandlerAdapter handlerAdapter, @Nullable Duration lifecycleTimeout, @Nullable org.springframework.boot.web.server.Shutdown shutdown, @Nullable org.springframework.http.client.ReactorResourceFactory resourceFactory) Creates a newNettyWebServerinstance.- Parameters:
httpServer- the HTTP serverhandlerAdapter- the handler adapterlifecycleTimeout- the lifecycle timeout, may benullshutdown- the shutdown, may benullresourceFactory- the factory for the server'sloop resources, may benull- Since:
- 4.0.0
-
-
Method Details
-
setRouteProviders
-
start
public void start() throws org.springframework.boot.web.server.WebServerException- Specified by:
startin interfaceorg.springframework.boot.web.server.WebServer- Throws:
org.springframework.boot.web.server.WebServerException
-
getStartedLogMessage
-
shutDownGracefully
public void shutDownGracefully(org.springframework.boot.web.server.GracefulShutdownCallback callback) Initiates a graceful shutdown of the Netty web server. Handling of new requests is prevented and the givencallbackis invoked at the end of the attempt. The attempt can be explicitly ended by invokingstop().Once shutdown has been initiated Netty will reject any new connections. Requests + on existing idle connections will also be rejected.
- Specified by:
shutDownGracefullyin interfaceorg.springframework.boot.web.server.WebServer
-
stop
public void stop() throws org.springframework.boot.web.server.WebServerException- Specified by:
stopin interfaceorg.springframework.boot.web.server.WebServer- Throws:
org.springframework.boot.web.server.WebServerException
-
getPort
public int getPort()- Specified by:
getPortin interfaceorg.springframework.boot.web.server.WebServer
-