类 JettyServletWebServerFactory

所有已实现的接口:
Aware, ConfigurableJettyWebServerFactory, ConfigurableWebServerFactory, ErrorPageRegistry, WebServerFactory, ConfigurableServletWebServerFactory, ServletWebServerFactory, WebListenerRegistry, ResourceLoaderAware

public class JettyServletWebServerFactory extends AbstractServletWebServerFactory implements ConfigurableJettyWebServerFactory, ResourceLoaderAware
ServletWebServerFactory that can be used to create a JettyWebServer. Can be initialized using Spring's ServletContextInitializers or Jetty Configurations.

Unless explicitly configured otherwise this factory will create servers that listen for HTTP requests on port 8080.

从以下版本开始:
2.0.0
作者:
Phillip Webb, Dave Syer, Andrey Hihlovskiy, Andy Wilkinson, Eddú Meléndez, Venil Noronha, Henri Kerola, Moritz Halbritter, Onur Kagan Ozcan
另请参阅:
  • 构造器详细资料

    • JettyServletWebServerFactory

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

      public JettyServletWebServerFactory(int port)
      Create a new JettyServletWebServerFactory that listens for requests using the specified port.
      参数:
      port - the port to listen on
    • JettyServletWebServerFactory

      public JettyServletWebServerFactory(String contextPath, int port)
      Create a new JettyServletWebServerFactory with the specified context path and port.
      参数:
      contextPath - the root context path
      port - the port to listen on
  • 方法详细资料

    • getWebServer

      public WebServer getWebServer(ServletContextInitializer... initializers)
      从接口复制的说明: ServletWebServerFactory
      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).
      指定者:
      getWebServer 在接口中 ServletWebServerFactory
      参数:
      initializers - ServletContextInitializers that should be applied as the server starts
      返回:
      a fully configured and started WebServer
      另请参阅:
    • configureWebAppContext

      protected final void configureWebAppContext(org.eclipse.jetty.ee10.webapp.WebAppContext context, ServletContextInitializer... initializers)
      Configure the given Jetty WebAppContext for use.
      参数:
      context - the context to configure
      initializers - the set of initializers to apply
    • addDefaultServlet

      protected final void addDefaultServlet(org.eclipse.jetty.ee10.webapp.WebAppContext context)
      Add Jetty's DefaultServlet to the given WebAppContext.
      参数:
      context - the jetty WebAppContext
    • addJspServlet

      protected final void addJspServlet(org.eclipse.jetty.ee10.webapp.WebAppContext context)
      Add Jetty's JspServlet to the given WebAppContext.
      参数:
      context - the jetty WebAppContext
    • getWebAppContextConfigurations

      protected org.eclipse.jetty.ee10.webapp.Configuration[] getWebAppContextConfigurations(org.eclipse.jetty.ee10.webapp.WebAppContext webAppContext, ServletContextInitializer... initializers)
      Return the Jetty Configurations that should be applied to the server.
      参数:
      webAppContext - the Jetty WebAppContext
      initializers - the ServletContextInitializers to apply
      返回:
      configurations to apply
    • getServletContextInitializerConfiguration

      protected org.eclipse.jetty.ee10.webapp.Configuration getServletContextInitializerConfiguration(org.eclipse.jetty.ee10.webapp.WebAppContext webAppContext, ServletContextInitializer... initializers)
      Return a Jetty Configuration that will invoke the specified ServletContextInitializers. By default this method will return a ServletContextInitializerConfiguration.
      参数:
      webAppContext - the Jetty WebAppContext
      initializers - the ServletContextInitializers to apply
      返回:
      the Configuration instance
    • postProcessWebAppContext

      protected void postProcessWebAppContext(org.eclipse.jetty.ee10.webapp.WebAppContext webAppContext)
      Post process the Jetty WebAppContext before it's used with the Jetty Server. Subclasses can override this method to apply additional processing to the WebAppContext.
      参数:
      webAppContext - the Jetty WebAppContext
    • getJettyWebServer

      protected JettyWebServer getJettyWebServer(org.eclipse.jetty.server.Server server)
      Factory method called to create the JettyWebServer. Subclasses can override this method to return a different JettyWebServer or apply additional processing to the Jetty server.
      参数:
      server - the Jetty server.
      返回:
      a new JettyWebServer instance
    • setResourceLoader

      public void setResourceLoader(ResourceLoader resourceLoader)
      指定者:
      setResourceLoader 在接口中 ResourceLoaderAware
    • setUseForwardHeaders

      public void setUseForwardHeaders(boolean useForwardHeaders)
      从接口复制的说明: ConfigurableJettyWebServerFactory
      Set if x-forward-* headers should be processed.
      指定者:
      setUseForwardHeaders 在接口中 ConfigurableJettyWebServerFactory
      参数:
      useForwardHeaders - if x-forward headers should be used
    • setAcceptors

      public void setAcceptors(int acceptors)
      从接口复制的说明: ConfigurableJettyWebServerFactory
      Set the number of acceptor threads to use.
      指定者:
      setAcceptors 在接口中 ConfigurableJettyWebServerFactory
      参数:
      acceptors - the number of acceptor threads to use
    • setSelectors

      public void setSelectors(int selectors)
      从接口复制的说明: ConfigurableJettyWebServerFactory
      Set the number of selector threads to use.
      指定者:
      setSelectors 在接口中 ConfigurableJettyWebServerFactory
      参数:
      selectors - the number of selector threads to use
    • setMaxConnections

      public void setMaxConnections(int maxConnections)
      从接口复制的说明: ConfigurableJettyWebServerFactory
      Sets the maximum number of concurrent connections.
      指定者:
      setMaxConnections 在接口中 ConfigurableJettyWebServerFactory
      参数:
      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.
      参数:
      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.
      返回:
      the JettyServerCustomizers
    • addServerCustomizers

      public void addServerCustomizers(JettyServerCustomizer... customizers)
      从接口复制的说明: ConfigurableJettyWebServerFactory
      Add JettyServerCustomizers that will be applied to the Server before it is started.
      指定者:
      addServerCustomizers 在接口中 ConfigurableJettyWebServerFactory
      参数:
      customizers - the customizers to add
    • 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.
      参数:
      configurations - the Jetty configurations to apply
    • 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.
      返回:
      the Jetty Configurations
    • 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.
      参数:
      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.
      返回:
      a Jetty ThreadPool or null
    • setThreadPool

      public void setThreadPool(org.eclipse.jetty.util.thread.ThreadPool threadPool)
      从接口复制的说明: ConfigurableJettyWebServerFactory
      Set the ThreadPool that should be used by the Server. If set to null (default), the Server creates a ThreadPool implicitly.
      指定者:
      setThreadPool 在接口中 ConfigurableJettyWebServerFactory
      参数:
      threadPool - the ThreadPool to be used