类 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 ServletContextInitializer
s or Jetty
Configuration
s.
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 newJettyServletWebServerFactory
instance.JettyServletWebServerFactory
(int port) Create a newJettyServletWebServerFactory
that listens for requests using the specified port.JettyServletWebServerFactory
(String contextPath, int port) Create a newJettyServletWebServerFactory
with the specified context path and port. -
方法概要
修饰符和类型方法说明void
addConfigurations
(org.eclipse.jetty.ee10.webapp.Configuration... configurations) AddConfiguration
s that will be applied to theWebAppContext
before the server is started.protected final void
addDefaultServlet
(org.eclipse.jetty.ee10.webapp.WebAppContext context) Add Jetty'sDefaultServlet
to the givenWebAppContext
.protected final void
addJspServlet
(org.eclipse.jetty.ee10.webapp.WebAppContext context) Add Jetty'sJspServlet
to the givenWebAppContext
.void
addServerCustomizers
(JettyServerCustomizer... customizers) AddJettyServerCustomizer
s that will be applied to theServer
before it is started.protected final void
configureWebAppContext
(org.eclipse.jetty.ee10.webapp.WebAppContext context, ServletContextInitializer... initializers) Configure the given JettyWebAppContext
for use.Collection
<org.eclipse.jetty.ee10.webapp.Configuration> Returns a mutable collection of JettyConfiguration
s that will be applied to theWebAppContext
before the server is created.protected JettyWebServer
getJettyWebServer
(org.eclipse.jetty.server.Server server) Factory method called to create theJettyWebServer
.Returns a mutable collection of JettyJettyServerCustomizer
s that will be applied to theServer
before it is created.protected org.eclipse.jetty.ee10.webapp.Configuration
getServletContextInitializerConfiguration
(org.eclipse.jetty.ee10.webapp.WebAppContext webAppContext, ServletContextInitializer... initializers) Return a JettyConfiguration
that will invoke the specifiedServletContextInitializer
s.org.eclipse.jetty.util.thread.ThreadPool
Returns a JettyThreadPool
that should be used by theServer
.protected org.eclipse.jetty.ee10.webapp.Configuration[]
getWebAppContextConfigurations
(org.eclipse.jetty.ee10.webapp.WebAppContext webAppContext, ServletContextInitializer... initializers) Return the JettyConfiguration
s that should be applied to the server.getWebServer
(ServletContextInitializer... initializers) Gets a new fully configured but pausedWebServer
instance.protected void
postProcessWebAppContext
(org.eclipse.jetty.ee10.webapp.WebAppContext webAppContext) Post process the JettyWebAppContext
before it's used with the Jetty Server.void
setAcceptors
(int acceptors) Set the number of acceptor threads to use.void
setConfigurations
(Collection<? extends org.eclipse.jetty.ee10.webapp.Configuration> configurations) Sets JettyConfiguration
s that will be applied to theWebAppContext
before the server is created.void
setMaxConnections
(int maxConnections) Sets the maximum number of concurrent connections.void
setResourceLoader
(ResourceLoader resourceLoader) void
setSelectors
(int selectors) Set the number of selector threads to use.void
setServerCustomizers
(Collection<? extends JettyServerCustomizer> customizers) SetsJettyServerCustomizer
s that will be applied to theServer
before it is started.void
setThreadPool
(org.eclipse.jetty.util.thread.ThreadPool threadPool) Set theThreadPool
that should be used by theServer
.void
setUseForwardHeaders
(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 newJettyServletWebServerFactory
instance. -
JettyServletWebServerFactory
public JettyServletWebServerFactory(int port) Create a newJettyServletWebServerFactory
that listens for requests using the specified port.- 参数:
port
- the port to listen on
-
JettyServletWebServerFactory
Create a newJettyServletWebServerFactory
with the specified context path and port.- 参数:
contextPath
- the root context pathport
- the port to listen on
-
-
方法详细资料
-
getWebServer
从接口复制的说明:ServletWebServerFactory
Gets a new fully configured but pausedWebServer
instance. Clients should not be able to connect to the returned server untilWebServer.start()
is called (which happens when theApplicationContext
has been fully refreshed).- 指定者:
getWebServer
在接口中ServletWebServerFactory
- 参数:
initializers
-ServletContextInitializer
s 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 JettyWebAppContext
for 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'sDefaultServlet
to the givenWebAppContext
.- 参数:
context
- the jettyWebAppContext
-
addJspServlet
protected final void addJspServlet(org.eclipse.jetty.ee10.webapp.WebAppContext context) Add Jetty'sJspServlet
to 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 JettyConfiguration
s that should be applied to the server.- 参数:
webAppContext
- the JettyWebAppContext
initializers
- theServletContextInitializer
s 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 JettyConfiguration
that will invoke the specifiedServletContextInitializer
s. By default this method will return aServletContextInitializerConfiguration
.- 参数:
webAppContext
- the JettyWebAppContext
initializers
- theServletContextInitializer
s to apply- 返回:
- the
Configuration
instance
-
postProcessWebAppContext
protected void postProcessWebAppContext(org.eclipse.jetty.ee10.webapp.WebAppContext webAppContext) Post process the JettyWebAppContext
before 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 differentJettyWebServer
or apply additional processing to the Jetty server.- 参数:
server
- the Jetty server.- 返回:
- a new
JettyWebServer
instance
-
setResourceLoader
- 指定者:
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
SetsJettyServerCustomizer
s that will be applied to theServer
before it is started. Calling this method will replace any existing customizers.- 参数:
customizers
- the Jetty customizers to apply
-
getServerCustomizers
Returns a mutable collection of JettyJettyServerCustomizer
s that will be applied to theServer
before it is created.- 返回:
- the
JettyServerCustomizer
s
-
addServerCustomizers
从接口复制的说明:ConfigurableJettyWebServerFactory
AddJettyServerCustomizer
s that will be applied to theServer
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 JettyConfiguration
s that will be applied to theWebAppContext
before the server is created. Calling this method will replace any existing configurations.- 参数:
configurations
- the Jetty configurations to apply
-
getConfigurations
Returns a mutable collection of JettyConfiguration
s that will be applied to theWebAppContext
before the server is created.- 返回:
- the Jetty
Configuration
s
-
addConfigurations
public void addConfigurations(org.eclipse.jetty.ee10.webapp.Configuration... configurations) AddConfiguration
s that will be applied to theWebAppContext
before the server is started.- 参数:
configurations
- the configurations to add
-
getThreadPool
public org.eclipse.jetty.util.thread.ThreadPool getThreadPool()Returns a JettyThreadPool
that should be used by theServer
.- 返回:
- a Jetty
ThreadPool
ornull
-
setThreadPool
public void setThreadPool(org.eclipse.jetty.util.thread.ThreadPool threadPool) 从接口复制的说明:ConfigurableJettyWebServerFactory
Set theThreadPool
that should be used by theServer
. If set tonull
(default), theServer
creates aThreadPool
implicitly.- 指定者:
setThreadPool
在接口中ConfigurableJettyWebServerFactory
- 参数:
threadPool
- the ThreadPool to be used
-