Class UndertowServletWebServerFactory
java.lang.Object
org.springframework.boot.web.server.AbstractConfigurableWebServerFactory
org.springframework.boot.undertow.UndertowWebServerFactory
org.springframework.boot.undertow.servlet.UndertowServletWebServerFactory
- All Implemented Interfaces:
Aware
,ConfigurableUndertowWebServerFactory
,ConfigurableWebServerFactory
,ErrorPageRegistry
,ConfigurableServletWebServerFactory
,ServletWebServerFactory
,WebListenerRegistry
,WebServerFactory
,ResourceLoaderAware
public class UndertowServletWebServerFactory
extends UndertowWebServerFactory
implements ConfigurableServletWebServerFactory, 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:
- 4.0.0
- Author:
- Ivan Sopov, Andy Wilkinson, Marcos Barbero, EddĂș MelĂ©ndez, Scott Frederick
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionCreate 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
addDeploymentInfoCustomizers
(UndertowDeploymentInfoCustomizer... customizers) AddUndertowDeploymentInfoCustomizer
s that should be used to customize the UndertowDeploymentInfo
.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
Return if filters should be eagerly initialized.boolean
Return whether the request path should be preserved on forward.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
setPreservePathOnForward
(boolean preservePathOnForward) Set whether the request path should be preserved on forward.void
setResourceLoader
(ResourceLoader resourceLoader) Methods inherited from class org.springframework.boot.undertow.UndertowWebServerFactory
addBuilderCustomizers, createBuilder, createHttpHandlerFactories, getAccessLogPrefix, getBuilderCustomizers, isAccessLogEnabled, isUseForwardHeaders, setAccessLogDirectory, setAccessLogEnabled, setAccessLogPattern, setAccessLogPrefix, setAccessLogRotate, setAccessLogSuffix, setBufferSize, setBuilderCustomizers, setIoThreads, setUseDirectBuffers, setUseForwardHeaders, setWorkerThreads
Methods inherited from class 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
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.servlet.ConfigurableServletWebServerFactory
addCookieSameSiteSuppliers, addInitializers, addMimeMappings, addWebListeners, getContextPath, setContextPath, setCookieSameSiteSuppliers, setDisplayName, setDocumentRoot, setInitializers, setInitParameters, setJsp, setLocaleCharsetMappings, setMimeMappings, setRegisterDefaultServlet, setSession
Methods inherited from interface org.springframework.boot.web.server.ConfigurableWebServerFactory
setAddress, setCompression, setErrorPages, setHttp2, setPort, setServerHeader, setShutdown, setSsl, setSslBundles
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
-
getDeploymentInfoCustomizers
Returns a mutable collection of theUndertowDeploymentInfoCustomizer
s that will be applied to the UndertowDeploymentInfo
.- Returns:
- the customizers that will be applied
-
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
-
setResourceLoader
- Specified by:
setResourceLoader
in interfaceResourceLoaderAware
-
isEagerFilterInit
public boolean isEagerFilterInit()Return if filters should be eagerly initialized.- Returns:
true
if filters are eagerly initialized, otherwisefalse
.
-
setEagerFilterInit
public void setEagerFilterInit(boolean eagerFilterInit) Set whether filters should be eagerly initialized.- Parameters:
eagerFilterInit
-true
if filters are eagerly initialized, otherwisefalse
.
-
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
.
-
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
.
-
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
-
getSettings
- Specified by:
getSettings
in interfaceConfigurableServletWebServerFactory
-