类 JettyServletWebServerFactory
java.lang.Object
org.springframework.boot.web.server.AbstractConfigurableWebServerFactory
org.springframework.boot.web.servlet.server.AbstractServletWebServerFactory
org.springframework.boot.web.embedded.jetty.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
- 另请参阅:
-
字段概要
从类继承的字段 org.springframework.boot.web.servlet.server.AbstractServletWebServerFactory
logger -
构造器概要
构造器构造器说明Create a newJettyServletWebServerFactoryinstance.JettyServletWebServerFactory(int port) Create a newJettyServletWebServerFactorythat listens for requests using the specified port.JettyServletWebServerFactory(String contextPath, int port) Create a newJettyServletWebServerFactorywith the specified context path and port. -
方法概要
修饰符和类型方法说明voidaddConfigurations(org.eclipse.jetty.ee10.webapp.Configuration... configurations) AddConfigurations that will be applied to theWebAppContextbefore the server is started.protected final voidaddDefaultServlet(org.eclipse.jetty.ee10.webapp.WebAppContext context) Add Jetty'sDefaultServletto the givenWebAppContext.protected final voidaddJspServlet(org.eclipse.jetty.ee10.webapp.WebAppContext context) Add Jetty'sJspServletto the givenWebAppContext.voidaddServerCustomizers(JettyServerCustomizer... customizers) AddJettyServerCustomizers that will be applied to theServerbefore it is started.protected final voidconfigureWebAppContext(org.eclipse.jetty.ee10.webapp.WebAppContext context, ServletContextInitializer... initializers) Configure the given JettyWebAppContextfor use.Collection<org.eclipse.jetty.ee10.webapp.Configuration> Returns a mutable collection of JettyConfigurations that will be applied to theWebAppContextbefore the server is created.protected JettyWebServergetJettyWebServer(org.eclipse.jetty.server.Server server) Factory method called to create theJettyWebServer.Returns a mutable collection of JettyJettyServerCustomizers that will be applied to theServerbefore it is created.protected org.eclipse.jetty.ee10.webapp.ConfigurationgetServletContextInitializerConfiguration(org.eclipse.jetty.ee10.webapp.WebAppContext webAppContext, ServletContextInitializer... initializers) Return a JettyConfigurationthat will invoke the specifiedServletContextInitializers.org.eclipse.jetty.util.thread.ThreadPoolReturns a JettyThreadPoolthat should be used by theServer.protected org.eclipse.jetty.ee10.webapp.Configuration[]getWebAppContextConfigurations(org.eclipse.jetty.ee10.webapp.WebAppContext webAppContext, ServletContextInitializer... initializers) Return the JettyConfigurations that should be applied to the server.getWebServer(ServletContextInitializer... initializers) Gets a new fully configured but pausedWebServerinstance.protected voidpostProcessWebAppContext(org.eclipse.jetty.ee10.webapp.WebAppContext webAppContext) Post process the JettyWebAppContextbefore it's used with the Jetty Server.voidsetAcceptors(int acceptors) Set the number of acceptor threads to use.voidsetConfigurations(Collection<? extends org.eclipse.jetty.ee10.webapp.Configuration> configurations) Sets JettyConfigurations that will be applied to theWebAppContextbefore the server is created.voidsetMaxConnections(int maxConnections) Sets the maximum number of concurrent connections.voidsetResourceLoader(ResourceLoader resourceLoader) voidsetSelectors(int selectors) Set the number of selector threads to use.voidsetServerCustomizers(Collection<? extends JettyServerCustomizer> customizers) SetsJettyServerCustomizers that will be applied to theServerbefore it is started.voidsetThreadPool(org.eclipse.jetty.util.thread.ThreadPool threadPool) Set theThreadPoolthat should be used by theServer.voidsetUseForwardHeaders(boolean useForwardHeaders) Set if x-forward-* headers should be processed.从类继承的方法 org.springframework.boot.web.servlet.server.AbstractServletWebServerFactory
addCookieSameSiteSuppliers, addInitializers, addMimeMappings, addWebListeners, getContextPath, getCookieSameSiteSuppliers, getDisplayName, getDocumentRoot, getInitParameters, getJsp, getLocaleCharsetMappings, getMimeMappings, getSession, getUrlsOfJarsWithMetaInfResources, getValidDocumentRoot, getValidSessionStoreDir, getValidSessionStoreDir, getWebListenerClassNames, isRegisterDefaultServlet, mergeInitializers, setContextPath, setCookieSameSiteSuppliers, setDisplayName, setDocumentRoot, setInitializers, setInitParameters, setJsp, setLocaleCharsetMappings, setMimeMappings, setRegisterDefaultServlet, setSession, shouldRegisterJspServlet从类继承的方法 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从类继承的方法 java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait从接口继承的方法 org.springframework.boot.web.server.ConfigurableWebServerFactory
setAddress, setCompression, setErrorPages, setHttp2, setPort, setServerHeader, setShutdown, setSsl, setSslBundles从接口继承的方法 org.springframework.boot.web.server.ErrorPageRegistry
addErrorPages
-
构造器详细资料
-
JettyServletWebServerFactory
public JettyServletWebServerFactory()Create a newJettyServletWebServerFactoryinstance. -
JettyServletWebServerFactory
public JettyServletWebServerFactory(int port) Create a newJettyServletWebServerFactorythat listens for requests using the specified port.- 参数:
port- the port to listen on
-
JettyServletWebServerFactory
Create a newJettyServletWebServerFactorywith the specified context path and port.- 参数:
contextPath- the root context pathport- the port to listen on
-
-
方法详细资料
-
getWebServer
从接口复制的说明:ServletWebServerFactoryGets a new fully configured but pausedWebServerinstance. Clients should not be able to connect to the returned server untilWebServer.start()is called (which happens when theApplicationContexthas 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 JettyWebAppContextfor use.- 参数:
context- the context to configureinitializers- the set of initializers to apply
-
addDefaultServlet
protected final void addDefaultServlet(org.eclipse.jetty.ee10.webapp.WebAppContext context) Add Jetty'sDefaultServletto the givenWebAppContext.- 参数:
context- the jettyWebAppContext
-
addJspServlet
protected final void addJspServlet(org.eclipse.jetty.ee10.webapp.WebAppContext context) Add Jetty'sJspServletto the givenWebAppContext.- 参数:
context- the jettyWebAppContext
-
getWebAppContextConfigurations
protected org.eclipse.jetty.ee10.webapp.Configuration[] getWebAppContextConfigurations(org.eclipse.jetty.ee10.webapp.WebAppContext webAppContext, ServletContextInitializer... initializers) Return the JettyConfigurations that should be applied to the server.- 参数:
webAppContext- the JettyWebAppContextinitializers- theServletContextInitializers 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 JettyConfigurationthat will invoke the specifiedServletContextInitializers. By default this method will return aServletContextInitializerConfiguration.- 参数:
webAppContext- the JettyWebAppContextinitializers- theServletContextInitializers to apply- 返回:
- the
Configurationinstance
-
postProcessWebAppContext
protected void postProcessWebAppContext(org.eclipse.jetty.ee10.webapp.WebAppContext webAppContext) Post process the JettyWebAppContextbefore it's used with the Jetty Server. Subclasses can override this method to apply additional processing to theWebAppContext.- 参数:
webAppContext- the JettyWebAppContext
-
getJettyWebServer
Factory method called to create theJettyWebServer. Subclasses can override this method to return a differentJettyWebServeror apply additional processing to the Jetty server.- 参数:
server- the Jetty server.- 返回:
- a new
JettyWebServerinstance
-
setResourceLoader
- 指定者:
setResourceLoader在接口中ResourceLoaderAware
-
setUseForwardHeaders
public void setUseForwardHeaders(boolean useForwardHeaders) 从接口复制的说明:ConfigurableJettyWebServerFactorySet if x-forward-* headers should be processed.- 指定者:
setUseForwardHeaders在接口中ConfigurableJettyWebServerFactory- 参数:
useForwardHeaders- if x-forward headers should be used
-
setAcceptors
public void setAcceptors(int acceptors) 从接口复制的说明:ConfigurableJettyWebServerFactorySet the number of acceptor threads to use.- 指定者:
setAcceptors在接口中ConfigurableJettyWebServerFactory- 参数:
acceptors- the number of acceptor threads to use
-
setSelectors
public void setSelectors(int selectors) 从接口复制的说明:ConfigurableJettyWebServerFactorySet the number of selector threads to use.- 指定者:
setSelectors在接口中ConfigurableJettyWebServerFactory- 参数:
selectors- the number of selector threads to use
-
setMaxConnections
public void setMaxConnections(int maxConnections) 从接口复制的说明:ConfigurableJettyWebServerFactorySets the maximum number of concurrent connections.- 指定者:
setMaxConnections在接口中ConfigurableJettyWebServerFactory- 参数:
maxConnections- the maximum number of concurrent connections
-
setServerCustomizers
SetsJettyServerCustomizers that will be applied to theServerbefore it is started. Calling this method will replace any existing customizers.- 参数:
customizers- the Jetty customizers to apply
-
getServerCustomizers
Returns a mutable collection of JettyJettyServerCustomizers that will be applied to theServerbefore it is created.- 返回:
- the
JettyServerCustomizers
-
addServerCustomizers
从接口复制的说明:ConfigurableJettyWebServerFactoryAddJettyServerCustomizers that will be applied to theServerbefore it is started.- 指定者:
addServerCustomizers在接口中ConfigurableJettyWebServerFactory- 参数:
customizers- the customizers to add
-
setConfigurations
public void setConfigurations(Collection<? extends org.eclipse.jetty.ee10.webapp.Configuration> configurations) Sets JettyConfigurations that will be applied to theWebAppContextbefore the server is created. Calling this method will replace any existing configurations.- 参数:
configurations- the Jetty configurations to apply
-
getConfigurations
Returns a mutable collection of JettyConfigurations that will be applied to theWebAppContextbefore the server is created.- 返回:
- the Jetty
Configurations
-
addConfigurations
public void addConfigurations(org.eclipse.jetty.ee10.webapp.Configuration... configurations) AddConfigurations that will be applied to theWebAppContextbefore the server is started.- 参数:
configurations- the configurations to add
-
getThreadPool
public org.eclipse.jetty.util.thread.ThreadPool getThreadPool()Returns a JettyThreadPoolthat should be used by theServer.- 返回:
- a Jetty
ThreadPoolornull
-
setThreadPool
public void setThreadPool(org.eclipse.jetty.util.thread.ThreadPool threadPool) 从接口复制的说明:ConfigurableJettyWebServerFactorySet theThreadPoolthat should be used by theServer. If set tonull(default), theServercreates aThreadPoolimplicitly.- 指定者:
setThreadPool在接口中ConfigurableJettyWebServerFactory- 参数:
threadPool- the ThreadPool to be used
-