Class NettyReactiveWebServerFactory

All Implemented Interfaces:
ConfigurableReactiveWebServerFactory, ReactiveWebServerFactory, ConfigurableWebServerFactory, ErrorPageRegistry, WebServerFactory

public class NettyReactiveWebServerFactory extends AbstractReactiveWebServerFactory
ReactiveWebServerFactory that can be used to create NettyWebServers.
Since:
2.0.0
  • Constructor Details

    • NettyReactiveWebServerFactory

      public NettyReactiveWebServerFactory()
    • NettyReactiveWebServerFactory

      public NettyReactiveWebServerFactory(int port)
  • Method Details

    • getWebServer

      public WebServer getWebServer(org.springframework.http.server.reactive.HttpHandler httpHandler)
      Description copied from interface: ReactiveWebServerFactory
      Gets a new fully configured but paused WebServer instance. Clients should not be able to connect to the returned server until WebServer.start() is called (which happens when the ApplicationContext has been fully refreshed).
      Parameters:
      httpHandler - the HTTP handler in charge of processing requests
      Returns:
      a fully configured and started WebServer
      See Also:
    • getServerCustomizers

      public Collection<NettyServerCustomizer> getServerCustomizers()
      Returns a mutable collection of the NettyServerCustomizers that will be applied to the Netty server builder.
      Returns:
      the customizers that will be applied
    • setServerCustomizers

      public void setServerCustomizers(Collection<? extends NettyServerCustomizer> serverCustomizers)
      Set NettyServerCustomizers that should be applied to the Netty server builder. Calling this method will replace any existing customizers.
      Parameters:
      serverCustomizers - the customizers to set
    • addServerCustomizers

      public void addServerCustomizers(NettyServerCustomizer... serverCustomizers)
      Add NettyServerCustomizers that should be applied while building the server.
      Parameters:
      serverCustomizers - the customizers to add
    • addRouteProviders

      public void addRouteProviders(NettyRouteProvider... routeProviders)
      Add NettyRouteProviders that should be applied, in order, before the handler for the Spring application.
      Parameters:
      routeProviders - the route providers to add
    • setLifecycleTimeout

      public void setLifecycleTimeout(Duration lifecycleTimeout)
      Set the maximum amount of time that should be waited when starting or stopping the server.
      Parameters:
      lifecycleTimeout - the lifecycle timeout
    • setUseForwardHeaders

      public void setUseForwardHeaders(boolean useForwardHeaders)
      Set if x-forward-* headers should be processed.
      Parameters:
      useForwardHeaders - if x-forward headers should be used
      Since:
      2.1.0
    • setResourceFactory

      public void setResourceFactory(org.springframework.http.client.reactive.ReactorResourceFactory resourceFactory)
      Set the ReactorResourceFactory to get the shared resources from.
      Parameters:
      resourceFactory - the server resources
      Since:
      2.1.0
    • setShutdown

      public void setShutdown(Shutdown shutdown)
      Description copied from interface: ConfigurableWebServerFactory
      Sets the shutdown configuration that will be applied to the server.
      Specified by:
      setShutdown in interface ConfigurableWebServerFactory
      Overrides:
      setShutdown in class AbstractConfigurableWebServerFactory
      Parameters:
      shutdown - the shutdown configuration
    • getShutdown

      public Shutdown getShutdown()
      Description copied from class: AbstractConfigurableWebServerFactory
      Returns the shutdown configuration that will be applied to the server.
      Overrides:
      getShutdown in class AbstractConfigurableWebServerFactory
      Returns:
      the shutdown configuration