类 NettyWebServer

java.lang.Object
org.springframework.boot.web.embedded.netty.NettyWebServer
所有已实现的接口:
WebServer

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.
从以下版本开始:
2.0.0
作者:
Brian Clozel, Madhura Bhave, Andy Wilkinson
  • 构造器详细资料

    • NettyWebServer

      public NettyWebServer(reactor.netty.http.server.HttpServer httpServer, ReactorHttpHandlerAdapter handlerAdapter, Duration lifecycleTimeout, Shutdown shutdown, ReactorResourceFactory resourceFactory)
      Creates a new NettyWebServer instance.
      参数:
      httpServer - the HTTP server
      handlerAdapter - the handler adapter
      lifecycleTimeout - the lifecycle timeout, may be null
      shutdown - the shutdown, may be null
      resourceFactory - the factory for the server's loop resources, may be null
      从以下版本开始:
      3.2.0
  • 方法详细资料

    • setRouteProviders

      public void setRouteProviders(List<NettyRouteProvider> routeProviders)
    • start

      public void start() throws WebServerException
      从接口复制的说明: WebServer
      Starts the web server. Calling this method on an already started server has no effect.
      指定者:
      start 在接口中 WebServer
      抛出:
      WebServerException - if the server cannot be started
    • getStartedLogMessage

      protected String getStartedLogMessage()
    • shutDownGracefully

      public void shutDownGracefully(GracefulShutdownCallback callback)
      Initiates a graceful shutdown of the Netty web server. Handling of new requests is prevented and the given callback is invoked at the end of the attempt. The attempt can be explicitly ended by invoking stop().

      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

      public void stop() throws WebServerException
      从接口复制的说明: WebServer
      Stops 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()
      从接口复制的说明: WebServer
      Return the port this server is listening on.
      指定者:
      getPort 在接口中 WebServer
      返回:
      the port (or -1 if none)