类 JettyEmbeddedServletContainerFactory
- java.lang.Object
- org.springframework.boot.context.embedded.AbstractConfigurableEmbeddedServletContainer
- org.springframework.boot.context.embedded.AbstractEmbeddedServletContainerFactory
- org.springframework.boot.context.embedded.jetty.JettyEmbeddedServletContainerFactory
- 所有已实现的接口:
org.springframework.beans.factory.Aware
,ConfigurableEmbeddedServletContainer
,EmbeddedServletContainerFactory
,ErrorPageRegistry
,org.springframework.context.ResourceLoaderAware
public class JettyEmbeddedServletContainerFactory extends AbstractEmbeddedServletContainerFactory implements org.springframework.context.ResourceLoaderAware
EmbeddedServletContainerFactory
that can be used to createJettyEmbeddedServletContainer
s. Can be initialized using Spring'sServletContextInitializer
s or JettyConfiguration
s.Unless explicitly configured otherwise this factory will created containers that listens for HTTP requests on port 8080.
字段概要
从类继承的字段 org.springframework.boot.context.embedded.AbstractEmbeddedServletContainerFactory
logger
构造器概要
构造器 构造器 说明 JettyEmbeddedServletContainerFactory()
Create a newJettyEmbeddedServletContainerFactory
instance.JettyEmbeddedServletContainerFactory(int port)
Create a newJettyEmbeddedServletContainerFactory
that listens for requests using the specified port.JettyEmbeddedServletContainerFactory(String contextPath, int port)
Create a newJettyEmbeddedServletContainerFactory
with the specified context path and port.
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 void
addConfigurations(org.eclipse.jetty.webapp.Configuration... configurations)
AddConfiguration
s that will be applied to theWebAppContext
before the server is started.protected void
addDefaultServlet(org.eclipse.jetty.webapp.WebAppContext context)
Add Jetty'sDefaultServlet
to the givenWebAppContext
.protected void
addJspServlet(org.eclipse.jetty.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 void
configureSsl(org.eclipse.jetty.util.ssl.SslContextFactory factory, Ssl ssl)
Configure the SSL connection.protected void
configureWebAppContext(org.eclipse.jetty.webapp.WebAppContext context, ServletContextInitializer... initializers)
Configure the given JettyWebAppContext
for use.Collection<org.eclipse.jetty.webapp.Configuration>
getConfigurations()
Returns a mutable collection of JettyConfiguration
s that will be applied to theWebAppContext
before the server is created.EmbeddedServletContainer
getEmbeddedServletContainer(ServletContextInitializer... initializers)
Gets a new fully configured but pausedEmbeddedServletContainer
instance.protected JettyEmbeddedServletContainer
getJettyEmbeddedServletContainer(org.eclipse.jetty.server.Server server)
Factory method called to create theJettyEmbeddedServletContainer
.Collection<JettyServerCustomizer>
getServerCustomizers()
Returns a mutable collection of JettyConfiguration
s that will be applied to theWebAppContext
before the server is created.protected org.eclipse.jetty.webapp.Configuration
getServletContextInitializerConfiguration(org.eclipse.jetty.webapp.WebAppContext webAppContext, ServletContextInitializer... initializers)
Return a JettyConfiguration
that will invoke the specifiedServletContextInitializer
s.org.eclipse.jetty.util.thread.ThreadPool
getThreadPool()
Returns a JettyThreadPool
that should be used by theServer
.protected org.eclipse.jetty.webapp.Configuration[]
getWebAppContextConfigurations(org.eclipse.jetty.webapp.WebAppContext webAppContext, ServletContextInitializer... initializers)
Return the JettyConfiguration
s that should be applied to the server.protected void
postProcessWebAppContext(org.eclipse.jetty.webapp.WebAppContext webAppContext)
Post process the JettyWebAppContext
before it used with the Jetty Server.void
setAcceptors(int acceptors)
Set the number of acceptor threads to use.void
setConfigurations(Collection<? extends org.eclipse.jetty.webapp.Configuration> configurations)
Sets JettyConfiguration
s that will be applied to theWebAppContext
before the server is created.void
setResourceLoader(org.springframework.core.io.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 a JettyThreadPool
that should be used by theServer
.void
setUseForwardHeaders(boolean useForwardHeaders)
Set if x-forward-* headers should be processed.从类继承的方法 org.springframework.boot.context.embedded.AbstractEmbeddedServletContainerFactory
createTempDir, getUrlsOfJarsWithMetaInfResources, getValidDocumentRoot, getValidSessionStoreDir, getValidSessionStoreDir
从类继承的方法 org.springframework.boot.context.embedded.AbstractConfigurableEmbeddedServletContainer
addErrorPages, addInitializers, getAddress, getCompression, getContextPath, getDisplayName, getDocumentRoot, getErrorPages, getJspServlet, getLocaleCharsetMappings, getMimeMappings, getPort, getServerHeader, getSessionStoreDir, getSessionTimeout, getSsl, getSslStoreProvider, isPersistSession, isRegisterDefaultServlet, mergeInitializers, setAddress, setCompression, setContextPath, setDisplayName, setDocumentRoot, setErrorPages, setInitializers, setJspServlet, setLocaleCharsetMappings, setMimeMappings, setPersistSession, setPort, setRegisterDefaultServlet, setServerHeader, setSessionStoreDir, setSessionTimeout, setSessionTimeout, setSsl, setSslStoreProvider, shouldRegisterJspServlet
构造器详细资料
JettyEmbeddedServletContainerFactory
public JettyEmbeddedServletContainerFactory()
Create a newJettyEmbeddedServletContainerFactory
instance.
JettyEmbeddedServletContainerFactory
public JettyEmbeddedServletContainerFactory(int port)
Create a newJettyEmbeddedServletContainerFactory
that listens for requests using the specified port.- 参数:
port
- the port to listen on
JettyEmbeddedServletContainerFactory
public JettyEmbeddedServletContainerFactory(String contextPath, int port)
Create a newJettyEmbeddedServletContainerFactory
with the specified context path and port.- 参数:
contextPath
- the root context pathport
- the port to listen on
方法详细资料
getEmbeddedServletContainer
public EmbeddedServletContainer getEmbeddedServletContainer(ServletContextInitializer... initializers)
从接口复制的说明:EmbeddedServletContainerFactory
Gets a new fully configured but pausedEmbeddedServletContainer
instance. Clients should not be able to connect to the returned server untilEmbeddedServletContainer.start()
is called (which happens when theApplicationContext
has been fully refreshed).- 指定者:
getEmbeddedServletContainer
在接口中EmbeddedServletContainerFactory
- 参数:
initializers
-ServletContextInitializer
s that should be applied as the container starts- 返回:
- a fully configured and started
EmbeddedServletContainer
- 另请参阅:
EmbeddedServletContainer.stop()
configureSsl
protected void configureSsl(org.eclipse.jetty.util.ssl.SslContextFactory factory, Ssl ssl)
Configure the SSL connection.- 参数:
factory
- the JettySslContextFactory
.ssl
- the ssl details.
configureWebAppContext
protected final void configureWebAppContext(org.eclipse.jetty.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.webapp.WebAppContext context)
Add Jetty'sDefaultServlet
to the givenWebAppContext
.- 参数:
context
- the jettyWebAppContext
addJspServlet
protected final void addJspServlet(org.eclipse.jetty.webapp.WebAppContext context)
Add Jetty'sJspServlet
to the givenWebAppContext
.- 参数:
context
- the jettyWebAppContext
getWebAppContextConfigurations
protected org.eclipse.jetty.webapp.Configuration[] getWebAppContextConfigurations(org.eclipse.jetty.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.webapp.Configuration getServletContextInitializerConfiguration(org.eclipse.jetty.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.webapp.WebAppContext webAppContext)
Post process the JettyWebAppContext
before it used with the Jetty Server. Subclasses can override this method to apply additional processing to theWebAppContext
.- 参数:
webAppContext
- the JettyWebAppContext
getJettyEmbeddedServletContainer
protected JettyEmbeddedServletContainer getJettyEmbeddedServletContainer(org.eclipse.jetty.server.Server server)
Factory method called to create theJettyEmbeddedServletContainer
. Subclasses can override this method to return a differentJettyEmbeddedServletContainer
or apply additional processing to the Jetty server.- 参数:
server
- the Jetty server.- 返回:
- a new
JettyEmbeddedServletContainer
instance
setResourceLoader
public void setResourceLoader(org.springframework.core.io.ResourceLoader resourceLoader)
- 指定者:
setResourceLoader
在接口中org.springframework.context.ResourceLoaderAware
setUseForwardHeaders
public void setUseForwardHeaders(boolean useForwardHeaders)
Set if x-forward-* headers should be processed.- 参数:
useForwardHeaders
- if x-forward headers should be used- 从以下版本开始:
- 1.3.0
setAcceptors
public void setAcceptors(int acceptors)
Set the number of acceptor threads to use.- 参数:
acceptors
- the number of acceptor threads to use- 从以下版本开始:
- 1.4.0
setSelectors
public void setSelectors(int selectors)
Set the number of selector threads to use.- 参数:
selectors
- the number of selector threads to use- 从以下版本开始:
- 1.4.0
setServerCustomizers
public void setServerCustomizers(Collection<? extends JettyServerCustomizer> customizers)
SetsJettyServerCustomizer
s that will be applied to theServer
before it is started. Calling this method will replace any existing configurations.- 参数:
customizers
- the Jetty customizers to apply
getServerCustomizers
public Collection<JettyServerCustomizer> getServerCustomizers()
Returns a mutable collection of JettyConfiguration
s that will be applied to theWebAppContext
before the server is created.- 返回:
- the Jetty
Configuration
s
addServerCustomizers
public void addServerCustomizers(JettyServerCustomizer... customizers)
AddJettyServerCustomizer
s that will be applied to theServer
before it is started.- 参数:
customizers
- the customizers to add
setConfigurations
public void setConfigurations(Collection<? extends org.eclipse.jetty.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
public Collection<org.eclipse.jetty.webapp.Configuration> 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.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)
Set a JettyThreadPool
that should be used by theServer
. If set tonull
(default), theServer
creates aThreadPool
implicitly.- 参数:
threadPool
- a Jetty ThreadPool to be used