类 NettyWebServer
java.lang.Object
org.springframework.boot.web.embedded.netty.NettyWebServer
- 所有已实现的接口:
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.- 从以下版本开始:
- 2.0.0
- 作者:
- Brian Clozel, Madhura Bhave, Andy Wilkinson
-
构造器概要
构造器构造器说明NettyWebServer(reactor.netty.http.server.HttpServer httpServer, ReactorHttpHandlerAdapter handlerAdapter, Duration lifecycleTimeout, Shutdown shutdown, ReactorResourceFactory resourceFactory) Creates a newNettyWebServerinstance. -
方法概要
修饰符和类型方法说明intgetPort()Return the port this server is listening on.protected StringvoidsetRouteProviders(List<NettyRouteProvider> routeProviders) voidshutDownGracefully(GracefulShutdownCallback callback) Initiates a graceful shutdown of the Netty web server.voidstart()Starts the web server.voidstop()Stops the web server.
-
构造器详细资料
-
NettyWebServer
public NettyWebServer(reactor.netty.http.server.HttpServer httpServer, ReactorHttpHandlerAdapter handlerAdapter, Duration lifecycleTimeout, Shutdown shutdown, ReactorResourceFactory resourceFactory) Creates a newNettyWebServerinstance.- 参数:
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- 从以下版本开始:
- 3.2.0
-
-
方法详细资料
-
setRouteProviders
-
start
从接口复制的说明:WebServerStarts the web server. Calling this method on an already started server has no effect.- 指定者:
start在接口中WebServer- 抛出:
WebServerException- if the server cannot be started
-
getStartedLogMessage
-
shutDownGracefully
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.
- 指定者:
shutDownGracefully在接口中WebServer- 参数:
callback- the callback to invoke when the graceful shutdown completes
-
stop
从接口复制的说明:WebServerStops the web server. Calling this method on an already stopped server has no effect.- 指定者:
stop在接口中WebServer- 抛出:
WebServerException- if the server cannot be stopped
-
getPort
public int getPort()从接口复制的说明:WebServerReturn the port this server is listening on.
-