Class JettyWebServerFactory

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

public class JettyWebServerFactory extends org.springframework.boot.web.server.AbstractConfigurableWebServerFactory implements ConfigurableJettyWebServerFactory
Base class for factories that produce a JettyWebServer.
Since:
4.0.0
  • Constructor Summary

    Constructors
    Constructor
    Description
     
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    addConfigurations(org.eclipse.jetty.ee11.webapp.Configuration... configurations)
    Add Configurations that will be applied to the WebAppContext before the server is started.
    protected org.eclipse.jetty.server.Handler
    addHandlerWrappers(org.eclipse.jetty.server.Handler handler)
     
    void
    Add JettyServerCustomizers that will be applied to the Server before it is started.
    protected org.eclipse.jetty.server.Handler
    applyWrapper(org.eclipse.jetty.server.Handler handler, org.eclipse.jetty.server.Handler.Wrapper wrapper)
     
    protected org.eclipse.jetty.server.AbstractConnector
    createConnector(InetSocketAddress address, org.eclipse.jetty.server.Server server)
     
    protected org.eclipse.jetty.server.AbstractConnector
    createConnector(InetSocketAddress address, org.eclipse.jetty.server.Server server, @Nullable Executor executor, @Nullable org.eclipse.jetty.util.thread.Scheduler scheduler, @Nullable org.eclipse.jetty.io.ByteBufferPool pool)
     
    protected void
    customizeSsl(org.eclipse.jetty.server.Server server, InetSocketAddress address)
     
    int
     
    Collection<org.eclipse.jetty.ee11.webapp.Configuration>
    Returns a mutable collection of Jetty Configurations that will be applied to the WebAppContext before the server is created.
    int
     
    int
     
    Returns a mutable collection of Jetty JettyServerCustomizers that will be applied to the Server before it is created.
    @Nullable org.eclipse.jetty.util.thread.ThreadPool
    Returns a Jetty ThreadPool that should be used by the Server.
    boolean
     
    void
    setAcceptors(int acceptors)
    Set the number of acceptor threads to use.
    void
    setConfigurations(Collection<? extends org.eclipse.jetty.ee11.webapp.Configuration> configurations)
    Sets Jetty Configurations that will be applied to the WebAppContext before the server is created.
    void
    setMaxConnections(int maxConnections)
    Sets the maximum number of concurrent connections.
    void
    setSelectors(int selectors)
    Set the number of selector threads to use.
    void
    Sets JettyServerCustomizers that will be applied to the Server before it is started.
    void
    setThreadPool(@Nullable org.eclipse.jetty.util.thread.ThreadPool threadPool)
    Set the ThreadPool that should be used by the Server.
    void
    setUseForwardHeaders(boolean useForwardHeaders)
    Set if x-forward-* headers should be processed.

    Methods inherited from class org.springframework.boot.web.server.AbstractConfigurableWebServerFactory

    addErrorPages, createTempDir, getAddress, getCompression, getErrorPages, getHttp2, getPort, getServerHeader, getServerNameSslBundles, getShutdown, getSsl, getSslBundle, getSslBundles, setAddress, setCompression, setErrorPages, setHttp2, setPort, setServerHeader, setShutdown, setSsl, setSslBundles

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface org.springframework.boot.web.server.ConfigurableWebServerFactory

    setAddress, setCompression, setErrorPages, setHttp2, setPort, setServerHeader, setShutdown, setSsl, setSslBundles

    Methods inherited from interface org.springframework.boot.web.error.ErrorPageRegistry

    addErrorPages
  • 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.ee11.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.ee11.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.ee11.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 @Nullable 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(@Nullable 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, @Nullable Executor executor, @Nullable org.eclipse.jetty.util.thread.Scheduler scheduler, @Nullable 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)