Class UndertowServletWebServerFactory
java.lang.Object
org.springframework.boot.web.server.AbstractConfigurableWebServerFactory
org.springframework.boot.web.servlet.server.AbstractServletWebServerFactory
org.springframework.boot.web.embedded.undertow.UndertowServletWebServerFactory
- All Implemented Interfaces:
org.springframework.beans.factory.Aware
,ConfigurableUndertowWebServerFactory
,ConfigurableWebServerFactory
,ErrorPageRegistry
,WebServerFactory
,ConfigurableServletWebServerFactory
,ServletWebServerFactory
,WebListenerRegistry
,org.springframework.context.ResourceLoaderAware
public class UndertowServletWebServerFactory
extends AbstractServletWebServerFactory
implements ConfigurableUndertowWebServerFactory, org.springframework.context.ResourceLoaderAware
ServletWebServerFactory
that can be used to create
UndertowServletWebServer
s.
Unless explicitly configured otherwise, the factory will create servers that listen for HTTP requests on port 8080.
- Since:
- 2.0.0
- See Also:
-
Field Summary
Fields inherited from class org.springframework.boot.web.servlet.server.AbstractServletWebServerFactory
logger
-
Constructor Summary
ConstructorDescriptionCreate a newUndertowServletWebServerFactory
instance.UndertowServletWebServerFactory
(int port) Create a newUndertowServletWebServerFactory
that listens for requests using the specified port.UndertowServletWebServerFactory
(String contextPath, int port) Create a newUndertowServletWebServerFactory
with the specified context path and port. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addBuilderCustomizers
(UndertowBuilderCustomizer... customizers) AddUndertowBuilderCustomizer
s that should be used to customize the UndertowUndertow.Builder
.void
addDeploymentInfoCustomizers
(UndertowDeploymentInfoCustomizer... customizers) AddUndertowDeploymentInfoCustomizer
s that should be used to customize the UndertowDeploymentInfo
.Returns a mutable collection of theUndertowBuilderCustomizer
s that will be applied to the UndertowUndertow.Builder
.Returns a mutable collection of theUndertowDeploymentInfoCustomizer
s that will be applied to the UndertowDeploymentInfo
.protected UndertowServletWebServer
getUndertowWebServer
(io.undertow.Undertow.Builder builder, io.undertow.servlet.api.DeploymentManager manager, int port) Factory method called to create theUndertowServletWebServer
.getWebServer
(ServletContextInitializer... initializers) Gets a new fully configured but pausedWebServer
instance.boolean
boolean
Return if filters should be eagerly initialized.boolean
Return whether the request path should be preserved on forward.protected final boolean
void
setAccessLogDirectory
(File accessLogDirectory) Set the access log directory.void
setAccessLogEnabled
(boolean accessLogEnabled) Set whether access logs are enabled.void
setAccessLogPattern
(String accessLogPattern) Set the access log pattern.void
setAccessLogPrefix
(String accessLogPrefix) Set the access log prefix.void
setAccessLogRotate
(boolean accessLogRotate) Set whether access logs rotation is enabled.void
setAccessLogSuffix
(String accessLogSuffix) Set the access log suffix.void
setBufferSize
(Integer bufferSize) Set the buffer size.void
setBuilderCustomizers
(Collection<? extends UndertowBuilderCustomizer> customizers) SetUndertowBuilderCustomizer
s that should be applied to the UndertowUndertow.Builder
.void
setDeploymentInfoCustomizers
(Collection<? extends UndertowDeploymentInfoCustomizer> customizers) SetUndertowDeploymentInfoCustomizer
s that should be applied to the UndertowDeploymentInfo
.void
setEagerFilterInit
(boolean eagerFilterInit) Set whether filters should be eagerly initialized.void
setIoThreads
(Integer ioThreads) Set the number of IO Threads.void
setPreservePathOnForward
(boolean preservePathOnForward) Set whether the request path should be preserved on forward.void
setResourceLoader
(org.springframework.core.io.ResourceLoader resourceLoader) void
setUseDirectBuffers
(Boolean directBuffers) Set whether direct buffers should be used.void
setUseForwardHeaders
(boolean useForwardHeaders) Set if x-forward-* headers should be processed.void
setWorkerThreads
(Integer workerThreads) Set the number of Worker Threads.Methods inherited from class org.springframework.boot.web.servlet.server.AbstractServletWebServerFactory
addCookieSameSiteSuppliers, addInitializers, 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
Methods inherited from class org.springframework.boot.web.server.AbstractConfigurableWebServerFactory
addErrorPages, createTempDir, getAddress, getCompression, getErrorPages, getHttp2, getOrCreateSslStoreProvider, getPort, getServerHeader, getShutdown, getSsl, getSslBundle, getSslStoreProvider, setAddress, setCompression, setErrorPages, setHttp2, setPort, setServerHeader, setShutdown, setSsl, setSslBundles, setSslStoreProvider
Methods inherited from class java.lang.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, setSslStoreProvider
Methods inherited from interface org.springframework.boot.web.server.ErrorPageRegistry
addErrorPages
-
Constructor Details
-
UndertowServletWebServerFactory
public UndertowServletWebServerFactory()Create a newUndertowServletWebServerFactory
instance. -
UndertowServletWebServerFactory
public UndertowServletWebServerFactory(int port) Create a newUndertowServletWebServerFactory
that listens for requests using the specified port.- Parameters:
port
- the port to listen on
-
UndertowServletWebServerFactory
Create a newUndertowServletWebServerFactory
with the specified context path and port.- Parameters:
contextPath
- the root context pathport
- the port to listen on
-
-
Method Details
-
setBuilderCustomizers
Description copied from interface:ConfigurableUndertowWebServerFactory
SetUndertowBuilderCustomizer
s that should be applied to the UndertowUndertow.Builder
. Calling this method will replace any existing customizers.- Specified by:
setBuilderCustomizers
in interfaceConfigurableUndertowWebServerFactory
- Parameters:
customizers
- the customizers to set
-
addBuilderCustomizers
Description copied from interface:ConfigurableUndertowWebServerFactory
AddUndertowBuilderCustomizer
s that should be used to customize the UndertowUndertow.Builder
.- Specified by:
addBuilderCustomizers
in interfaceConfigurableUndertowWebServerFactory
- Parameters:
customizers
- the customizers to add
-
getBuilderCustomizers
Returns a mutable collection of theUndertowBuilderCustomizer
s that will be applied to the UndertowUndertow.Builder
.- Returns:
- the customizers that will be applied
-
setBufferSize
Description copied from interface:ConfigurableUndertowWebServerFactory
Set the buffer size.- Specified by:
setBufferSize
in interfaceConfigurableUndertowWebServerFactory
- Parameters:
bufferSize
- buffer size
-
setIoThreads
Description copied from interface:ConfigurableUndertowWebServerFactory
Set the number of IO Threads.- Specified by:
setIoThreads
in interfaceConfigurableUndertowWebServerFactory
- Parameters:
ioThreads
- number of IO Threads
-
setWorkerThreads
Description copied from interface:ConfigurableUndertowWebServerFactory
Set the number of Worker Threads.- Specified by:
setWorkerThreads
in interfaceConfigurableUndertowWebServerFactory
- Parameters:
workerThreads
- number of Worker Threads
-
setUseDirectBuffers
Description copied from interface:ConfigurableUndertowWebServerFactory
Set whether direct buffers should be used.- Specified by:
setUseDirectBuffers
in interfaceConfigurableUndertowWebServerFactory
- Parameters:
directBuffers
- whether direct buffers should be used
-
setAccessLogDirectory
Description copied from interface:ConfigurableUndertowWebServerFactory
Set the access log directory.- Specified by:
setAccessLogDirectory
in interfaceConfigurableUndertowWebServerFactory
- Parameters:
accessLogDirectory
- access log directory
-
setAccessLogPattern
Description copied from interface:ConfigurableUndertowWebServerFactory
Set the access log pattern.- Specified by:
setAccessLogPattern
in interfaceConfigurableUndertowWebServerFactory
- Parameters:
accessLogPattern
- access log pattern
-
setAccessLogPrefix
Description copied from interface:ConfigurableUndertowWebServerFactory
Set the access log prefix.- Specified by:
setAccessLogPrefix
in interfaceConfigurableUndertowWebServerFactory
- Parameters:
accessLogPrefix
- log prefix
-
getAccessLogPrefix
-
setAccessLogSuffix
Description copied from interface:ConfigurableUndertowWebServerFactory
Set the access log suffix.- Specified by:
setAccessLogSuffix
in interfaceConfigurableUndertowWebServerFactory
- Parameters:
accessLogSuffix
- access log suffix
-
setAccessLogEnabled
public void setAccessLogEnabled(boolean accessLogEnabled) Description copied from interface:ConfigurableUndertowWebServerFactory
Set whether access logs are enabled.- Specified by:
setAccessLogEnabled
in interfaceConfigurableUndertowWebServerFactory
- Parameters:
accessLogEnabled
- whether access logs are enabled
-
isAccessLogEnabled
public boolean isAccessLogEnabled() -
setAccessLogRotate
public void setAccessLogRotate(boolean accessLogRotate) Description copied from interface:ConfigurableUndertowWebServerFactory
Set whether access logs rotation is enabled.- Specified by:
setAccessLogRotate
in interfaceConfigurableUndertowWebServerFactory
- Parameters:
accessLogRotate
- whether access logs rotation is enabled
-
setUseForwardHeaders
public void setUseForwardHeaders(boolean useForwardHeaders) Description copied from interface:ConfigurableUndertowWebServerFactory
Set if x-forward-* headers should be processed.- Specified by:
setUseForwardHeaders
in interfaceConfigurableUndertowWebServerFactory
- Parameters:
useForwardHeaders
- if x-forward headers should be used
-
isUseForwardHeaders
protected final boolean isUseForwardHeaders() -
setDeploymentInfoCustomizers
public void setDeploymentInfoCustomizers(Collection<? extends UndertowDeploymentInfoCustomizer> customizers) SetUndertowDeploymentInfoCustomizer
s that should be applied to the UndertowDeploymentInfo
. Calling this method will replace any existing customizers.- Parameters:
customizers
- the customizers to set
-
addDeploymentInfoCustomizers
AddUndertowDeploymentInfoCustomizer
s that should be used to customize the UndertowDeploymentInfo
.- Parameters:
customizers
- the customizers to add
-
getDeploymentInfoCustomizers
Returns a mutable collection of theUndertowDeploymentInfoCustomizer
s that will be applied to the UndertowDeploymentInfo
.- Returns:
- the customizers that will be applied
-
setResourceLoader
public void setResourceLoader(org.springframework.core.io.ResourceLoader resourceLoader) - Specified by:
setResourceLoader
in interfaceorg.springframework.context.ResourceLoaderAware
-
isEagerFilterInit
public boolean isEagerFilterInit()Return if filters should be eagerly initialized.- Returns:
true
if filters are eagerly initialized, otherwisefalse
.- Since:
- 2.4.0
-
setEagerFilterInit
public void setEagerFilterInit(boolean eagerFilterInit) Set whether filters should be eagerly initialized.- Parameters:
eagerFilterInit
-true
if filters are eagerly initialized, otherwisefalse
.- Since:
- 2.4.0
-
isPreservePathOnForward
public boolean isPreservePathOnForward()Return whether the request path should be preserved on forward.- Returns:
true
if the path should be preserved when a request is forwarded, otherwisefalse
.- Since:
- 2.4.0
-
setPreservePathOnForward
public void setPreservePathOnForward(boolean preservePathOnForward) Set whether the request path should be preserved on forward.- Parameters:
preservePathOnForward
-true
if the path should be preserved when a request is forwarded, otherwisefalse
.- Since:
- 2.4.0
-
getWebServer
Description copied from interface: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).- Specified by:
getWebServer
in interfaceServletWebServerFactory
- Parameters:
initializers
-ServletContextInitializer
s that should be applied as the server starts- Returns:
- a fully configured and started
WebServer
- See Also:
-
getUndertowWebServer
protected UndertowServletWebServer getUndertowWebServer(io.undertow.Undertow.Builder builder, io.undertow.servlet.api.DeploymentManager manager, int port) Factory method called to create theUndertowServletWebServer
. Subclasses can override this method to return a differentUndertowServletWebServer
or apply additional processing to theUndertow.Builder
andDeploymentManager
used to bootstrap Undertow- Parameters:
builder
- the buildermanager
- the deployment managerport
- the port that Undertow should listen on- Returns:
- a new
UndertowServletWebServer
instance
-