Class JettyWebServerFactory

java.lang.Object
org.springframework.boot.web.server.AbstractConfigurableWebServerFactory
org.springframework.boot.web.server.jetty.JettyWebServerFactory
All Implemented Interfaces:
ConfigurableWebServerFactory, ErrorPageRegistry, ConfigurableJettyWebServerFactory, WebServerFactory
Direct Known Subclasses:
JettyReactiveWebServerFactory, JettyServletWebServerFactory

public class JettyWebServerFactory extends AbstractConfigurableWebServerFactory implements ConfigurableJettyWebServerFactory
Base class for factories that produce a JettyWebServer.
Since:
4.0.0
Author:
Andy Wilkinson
  • Constructor Details

    • JettyWebServerFactory

      public JettyWebServerFactory()
    • JettyWebServerFactory

      public JettyWebServerFactory(int port)
  • Method Details

    • getAcceptors

      public int getAcceptors()
    • 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
    • getSelectors

      public int getSelectors()
    • 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
    • getMaxConnections

      public int getMaxConnections()
    • 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
    • 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 JettyServerCustomizers
    • 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
    • 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
    • getConfigurations

      public Collection<org.eclipse.jetty.ee10.webapp.Configuration> getConfigurations()
      Returns a mutable collection of Jetty Configurations that will be applied to the WebAppContext before the server is created.
      Returns:
      the Jetty Configurations
    • setConfigurations

      public void setConfigurations(Collection<? extends org.eclipse.jetty.ee10.webapp.Configuration> configurations)
      Sets Jetty Configurations that will be applied to the WebAppContext before the server is created. Calling this method will replace any existing configurations.
      Parameters:
      configurations - the Jetty configurations to apply
    • addConfigurations

      public void addConfigurations(org.eclipse.jetty.ee10.webapp.Configuration... configurations)
      Add Configurations that will be applied to the WebAppContext before the server is started.
      Parameters:
      configurations - the configurations to add
    • 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
    • isUseForwardHeaders

      public boolean isUseForwardHeaders()
    • 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
    • createConnector

      protected org.eclipse.jetty.server.AbstractConnector createConnector(InetSocketAddress address, org.eclipse.jetty.server.Server server)
    • createConnector

      protected org.eclipse.jetty.server.AbstractConnector createConnector(InetSocketAddress address, org.eclipse.jetty.server.Server server, Executor executor, org.eclipse.jetty.util.thread.Scheduler scheduler, org.eclipse.jetty.io.ByteBufferPool pool)
    • customizeSsl

      protected void customizeSsl(org.eclipse.jetty.server.Server server, InetSocketAddress address)
    • addHandlerWrappers

      protected org.eclipse.jetty.server.Handler addHandlerWrappers(org.eclipse.jetty.server.Handler handler)
    • applyWrapper

      protected org.eclipse.jetty.server.Handler applyWrapper(org.eclipse.jetty.server.Handler handler, org.eclipse.jetty.server.Handler.Wrapper wrapper)