public class NettyWebServer extends Object implements 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.| Constructor and Description |
|---|
NettyWebServer(reactor.netty.http.server.HttpServer httpServer,
ReactorHttpHandlerAdapter handlerAdapter,
Duration lifecycleTimeout) |
NettyWebServer(reactor.netty.http.server.HttpServer httpServer,
ReactorHttpHandlerAdapter handlerAdapter,
Duration lifecycleTimeout,
Duration shutdownGracePeriod)
Creates a
NettyWebServer. |
| Modifier and Type | Method and Description |
|---|---|
int |
getPort()
Return the port this server is listening on.
|
void |
setRouteProviders(List<NettyRouteProvider> routeProviders) |
boolean |
shutDownGracefully()
Gracefully shuts down the web server by preventing the handling of new requests and
waiting for a configurable period for there to be no active requests.
|
void |
start()
Starts the web server.
|
void |
stop()
Stops the web server.
|
public NettyWebServer(reactor.netty.http.server.HttpServer httpServer,
ReactorHttpHandlerAdapter handlerAdapter,
Duration lifecycleTimeout)
public NettyWebServer(reactor.netty.http.server.HttpServer httpServer,
ReactorHttpHandlerAdapter handlerAdapter,
Duration lifecycleTimeout,
Duration shutdownGracePeriod)
NettyWebServer.httpServer - the Reactor Netty HTTP serverhandlerAdapter - the Spring WebFlux handler adapterlifecycleTimeout - lifecycle timeoutshutdownGracePeriod - grace period for handler for graceful shutdownpublic void setRouteProviders(List<NettyRouteProvider> routeProviders)
public void start()
throws WebServerException
WebServerstart in interface WebServerWebServerException - if the server cannot be startedpublic boolean shutDownGracefully()
WebServershutDownGracefully in interface WebServertrue if graceful shutdown completed within the period, otherwise
falsepublic void stop()
throws WebServerException
WebServerstop in interface WebServerWebServerException - if the server cannot be stopped