Class JettyReactiveWebServerFactory

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

public class JettyReactiveWebServerFactory extends AbstractReactiveWebServerFactory implements ConfigurableJettyWebServerFactory
ReactiveWebServerFactory that can be used to create JettyWebServers.
Since:
2.0.0
  • Constructor Details

    • JettyReactiveWebServerFactory

      public JettyReactiveWebServerFactory()
      Create a new JettyServletWebServerFactory instance.
    • JettyReactiveWebServerFactory

      public JettyReactiveWebServerFactory(int port)
      Create a new JettyServletWebServerFactory that listens for requests using the specified port.
      Parameters:
      port - the port to listen on
  • Method Details

    • setUseForwardHeaders

      public void setUseForwardHeaders(boolean useForwardHeaders)
      Description copied from interface: ConfigurableJettyWebServerFactory
      Set if x-forward-* headers should be processed.
      Specified by:
      setUseForwardHeaders in interface ConfigurableJettyWebServerFactory
      Parameters:
      useForwardHeaders - if x-forward headers should be used
    • setAcceptors

      public void setAcceptors(int acceptors)
      Description copied from interface: ConfigurableJettyWebServerFactory
      Set the number of acceptor threads to use.
      Specified by:
      setAcceptors in interface ConfigurableJettyWebServerFactory
      Parameters:
      acceptors - the number of acceptor threads to use
    • 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).
      Specified by:
      getWebServer in interface ReactiveWebServerFactory
      Parameters:
      httpHandler - the HTTP handler in charge of processing requests
      Returns:
      a fully configured and started WebServer
      See Also:
    • addServerCustomizers

      public void addServerCustomizers(JettyServerCustomizer... customizers)
      Description copied from interface: ConfigurableJettyWebServerFactory
      Add JettyServerCustomizers that will be applied to the Server before it is started.
      Specified by:
      addServerCustomizers in interface ConfigurableJettyWebServerFactory
      Parameters:
      customizers - the customizers to add
    • setMaxConnections

      public void setMaxConnections(int maxConnections)
      Description copied from interface: ConfigurableJettyWebServerFactory
      Sets the maximum number of concurrent connections.
      Specified by:
      setMaxConnections in interface ConfigurableJettyWebServerFactory
      Parameters:
      maxConnections - the maximum number of concurrent connections
    • setServerCustomizers

      public void setServerCustomizers(Collection<? extends JettyServerCustomizer> customizers)
      Sets JettyServerCustomizers that will be applied to the Server before it is started. Calling this method will replace any existing customizers.
      Parameters:
      customizers - the Jetty customizers to apply
    • getServerCustomizers

      public Collection<JettyServerCustomizer> getServerCustomizers()
      Returns a mutable collection of Jetty JettyServerCustomizers that will be applied to the Server before it is created.
      Returns:
      the Jetty customizers
    • getThreadPool

      public org.eclipse.jetty.util.thread.ThreadPool getThreadPool()
      Returns a Jetty ThreadPool that should be used by the Server.
      Returns:
      a Jetty ThreadPool or null
    • setThreadPool

      public void setThreadPool(org.eclipse.jetty.util.thread.ThreadPool threadPool)
      Description copied from interface: ConfigurableJettyWebServerFactory
      Set the ThreadPool that should be used by the Server. If set to null (default), the Server creates a ThreadPool implicitly.
      Specified by:
      setThreadPool in interface ConfigurableJettyWebServerFactory
      Parameters:
      threadPool - the ThreadPool to be used
    • setSelectors

      public void setSelectors(int selectors)
      Description copied from interface: ConfigurableJettyWebServerFactory
      Set the number of selector threads to use.
      Specified by:
      setSelectors in interface ConfigurableJettyWebServerFactory
      Parameters:
      selectors - the number of selector threads to use
    • setResourceFactory

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

      protected org.springframework.http.client.reactive.JettyResourceFactory getResourceFactory()
    • createJettyServer

      protected org.eclipse.jetty.server.Server createJettyServer(org.springframework.http.server.reactive.JettyHttpHandlerAdapter servlet)