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:
Aware,ConfigurableUndertowWebServerFactory,ConfigurableWebServerFactory,ErrorPageRegistry,WebServerFactory,ConfigurableServletWebServerFactory,ServletWebServerFactory,WebListenerRegistry,ResourceLoaderAware
public class UndertowServletWebServerFactory
extends AbstractServletWebServerFactory
implements ConfigurableUndertowWebServerFactory, ResourceLoaderAware
ServletWebServerFactory that can be used to create
UndertowServletWebServers.
Unless explicitly configured otherwise, the factory will create servers that listen for HTTP requests on port 8080.
- Since:
- 2.0.0
- Author:
- Ivan Sopov, Andy Wilkinson, Marcos Barbero, EddĂș MelĂ©ndez
- See Also:
-
Field Summary
Fields inherited from class org.springframework.boot.web.servlet.server.AbstractServletWebServerFactory
logger -
Constructor Summary
ConstructorsConstructorDescriptionCreate a newUndertowServletWebServerFactoryinstance.UndertowServletWebServerFactory(int port) Create a newUndertowServletWebServerFactorythat listens for requests using the specified port.UndertowServletWebServerFactory(String contextPath, int port) Create a newUndertowServletWebServerFactorywith the specified context path and port. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddBuilderCustomizers(UndertowBuilderCustomizer... customizers) AddUndertowBuilderCustomizers that should be used to customize the UndertowUndertow.Builder.voidaddDeploymentInfoCustomizers(UndertowDeploymentInfoCustomizer... customizers) AddUndertowDeploymentInfoCustomizers that should be used to customize the UndertowDeploymentInfo.Returns a mutable collection of theUndertowBuilderCustomizers that will be applied to the UndertowUndertow.Builder.Returns a mutable collection of theUndertowDeploymentInfoCustomizers that will be applied to the UndertowDeploymentInfo.protected UndertowServletWebServergetUndertowWebServer(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 pausedWebServerinstance.booleanbooleanReturn if filters should be eagerly initialized.booleanReturn whether the request path should be preserved on forward.protected final booleanvoidsetAccessLogDirectory(File accessLogDirectory) Set the access log directory.voidsetAccessLogEnabled(boolean accessLogEnabled) Set whether access logs are enabled.voidsetAccessLogPattern(String accessLogPattern) Set the access log pattern.voidsetAccessLogPrefix(String accessLogPrefix) Set the access log prefix.voidsetAccessLogRotate(boolean accessLogRotate) Set whether access logs rotation is enabled.voidsetAccessLogSuffix(String accessLogSuffix) Set the access log suffix.voidsetBufferSize(Integer bufferSize) Set the buffer size.voidsetBuilderCustomizers(Collection<? extends UndertowBuilderCustomizer> customizers) SetUndertowBuilderCustomizers that should be applied to the UndertowUndertow.Builder.voidsetDeploymentInfoCustomizers(Collection<? extends UndertowDeploymentInfoCustomizer> customizers) SetUndertowDeploymentInfoCustomizers that should be applied to the UndertowDeploymentInfo.voidsetEagerFilterInit(boolean eagerFilterInit) Set whether filters should be eagerly initialized.voidsetIoThreads(Integer ioThreads) Set the number of IO Threads.voidsetPreservePathOnForward(boolean preservePathOnForward) Set whether the request path should be preserved on forward.voidsetResourceLoader(ResourceLoader resourceLoader) voidsetUseDirectBuffers(Boolean directBuffers) Set whether direct buffers should be used.voidsetUseForwardHeaders(boolean useForwardHeaders) Set if x-forward-* headers should be processed.voidsetWorkerThreads(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, shouldRegisterJspServletMethods inherited from class org.springframework.boot.web.server.AbstractConfigurableWebServerFactory
addErrorPages, createTempDir, getAddress, getCompression, getErrorPages, getHttp2, getOrCreateSslStoreProvider, getPort, getServerHeader, getShutdown, getSsl, getSslBundle, getSslBundles, getSslStoreProvider, setAddress, setCompression, setErrorPages, setHttp2, setPort, setServerHeader, setShutdown, setSsl, setSslBundles, setSslStoreProviderMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.springframework.boot.web.server.ConfigurableWebServerFactory
setAddress, setCompression, setErrorPages, setHttp2, setPort, setServerHeader, setShutdown, setSsl, setSslBundles, setSslStoreProviderMethods inherited from interface org.springframework.boot.web.server.ErrorPageRegistry
addErrorPages
-
Constructor Details
-
UndertowServletWebServerFactory
public UndertowServletWebServerFactory()Create a newUndertowServletWebServerFactoryinstance. -
UndertowServletWebServerFactory
public UndertowServletWebServerFactory(int port) Create a newUndertowServletWebServerFactorythat listens for requests using the specified port.- Parameters:
port- the port to listen on
-
UndertowServletWebServerFactory
Create a newUndertowServletWebServerFactorywith the specified context path and port.- Parameters:
contextPath- the root context pathport- the port to listen on
-
-
Method Details
-
setBuilderCustomizers
Description copied from interface:ConfigurableUndertowWebServerFactorySetUndertowBuilderCustomizers that should be applied to the UndertowUndertow.Builder. Calling this method will replace any existing customizers.- Specified by:
setBuilderCustomizersin interfaceConfigurableUndertowWebServerFactory- Parameters:
customizers- the customizers to set
-
addBuilderCustomizers
Description copied from interface:ConfigurableUndertowWebServerFactoryAddUndertowBuilderCustomizers that should be used to customize the UndertowUndertow.Builder.- Specified by:
addBuilderCustomizersin interfaceConfigurableUndertowWebServerFactory- Parameters:
customizers- the customizers to add
-
getBuilderCustomizers
Returns a mutable collection of theUndertowBuilderCustomizers that will be applied to the UndertowUndertow.Builder.- Returns:
- the customizers that will be applied
-
setBufferSize
Description copied from interface:ConfigurableUndertowWebServerFactorySet the buffer size.- Specified by:
setBufferSizein interfaceConfigurableUndertowWebServerFactory- Parameters:
bufferSize- buffer size
-
setIoThreads
Description copied from interface:ConfigurableUndertowWebServerFactorySet the number of IO Threads.- Specified by:
setIoThreadsin interfaceConfigurableUndertowWebServerFactory- Parameters:
ioThreads- number of IO Threads
-
setWorkerThreads
Description copied from interface:ConfigurableUndertowWebServerFactorySet the number of Worker Threads.- Specified by:
setWorkerThreadsin interfaceConfigurableUndertowWebServerFactory- Parameters:
workerThreads- number of Worker Threads
-
setUseDirectBuffers
Description copied from interface:ConfigurableUndertowWebServerFactorySet whether direct buffers should be used.- Specified by:
setUseDirectBuffersin interfaceConfigurableUndertowWebServerFactory- Parameters:
directBuffers- whether direct buffers should be used
-
setAccessLogDirectory
Description copied from interface:ConfigurableUndertowWebServerFactorySet the access log directory.- Specified by:
setAccessLogDirectoryin interfaceConfigurableUndertowWebServerFactory- Parameters:
accessLogDirectory- access log directory
-
setAccessLogPattern
Description copied from interface:ConfigurableUndertowWebServerFactorySet the access log pattern.- Specified by:
setAccessLogPatternin interfaceConfigurableUndertowWebServerFactory- Parameters:
accessLogPattern- access log pattern
-
setAccessLogPrefix
Description copied from interface:ConfigurableUndertowWebServerFactorySet the access log prefix.- Specified by:
setAccessLogPrefixin interfaceConfigurableUndertowWebServerFactory- Parameters:
accessLogPrefix- log prefix
-
getAccessLogPrefix
-
setAccessLogSuffix
Description copied from interface:ConfigurableUndertowWebServerFactorySet the access log suffix.- Specified by:
setAccessLogSuffixin interfaceConfigurableUndertowWebServerFactory- Parameters:
accessLogSuffix- access log suffix
-
setAccessLogEnabled
public void setAccessLogEnabled(boolean accessLogEnabled) Description copied from interface:ConfigurableUndertowWebServerFactorySet whether access logs are enabled.- Specified by:
setAccessLogEnabledin interfaceConfigurableUndertowWebServerFactory- Parameters:
accessLogEnabled- whether access logs are enabled
-
isAccessLogEnabled
public boolean isAccessLogEnabled() -
setAccessLogRotate
public void setAccessLogRotate(boolean accessLogRotate) Description copied from interface:ConfigurableUndertowWebServerFactorySet whether access logs rotation is enabled.- Specified by:
setAccessLogRotatein interfaceConfigurableUndertowWebServerFactory- Parameters:
accessLogRotate- whether access logs rotation is enabled
-
setUseForwardHeaders
public void setUseForwardHeaders(boolean useForwardHeaders) Description copied from interface:ConfigurableUndertowWebServerFactorySet if x-forward-* headers should be processed.- Specified by:
setUseForwardHeadersin interfaceConfigurableUndertowWebServerFactory- Parameters:
useForwardHeaders- if x-forward headers should be used
-
isUseForwardHeaders
protected final boolean isUseForwardHeaders() -
setDeploymentInfoCustomizers
public void setDeploymentInfoCustomizers(Collection<? extends UndertowDeploymentInfoCustomizer> customizers) SetUndertowDeploymentInfoCustomizers that should be applied to the UndertowDeploymentInfo. Calling this method will replace any existing customizers.- Parameters:
customizers- the customizers to set
-
addDeploymentInfoCustomizers
AddUndertowDeploymentInfoCustomizers that should be used to customize the UndertowDeploymentInfo.- Parameters:
customizers- the customizers to add
-
getDeploymentInfoCustomizers
Returns a mutable collection of theUndertowDeploymentInfoCustomizers that will be applied to the UndertowDeploymentInfo.- Returns:
- the customizers that will be applied
-
setResourceLoader
- Specified by:
setResourceLoaderin interfaceResourceLoaderAware
-
isEagerFilterInit
public boolean isEagerFilterInit()Return if filters should be eagerly initialized.- Returns:
trueif filters are eagerly initialized, otherwisefalse.- Since:
- 2.4.0
-
setEagerFilterInit
public void setEagerFilterInit(boolean eagerFilterInit) Set whether filters should be eagerly initialized.- Parameters:
eagerFilterInit-trueif filters are eagerly initialized, otherwisefalse.- Since:
- 2.4.0
-
isPreservePathOnForward
public boolean isPreservePathOnForward()Return whether the request path should be preserved on forward.- Returns:
trueif 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-trueif the path should be preserved when a request is forwarded, otherwisefalse.- Since:
- 2.4.0
-
getWebServer
Description copied from interface: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).- Specified by:
getWebServerin interfaceServletWebServerFactory- Parameters:
initializers-ServletContextInitializers 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 differentUndertowServletWebServeror apply additional processing to theUndertow.BuilderandDeploymentManagerused to bootstrap Undertow- Parameters:
builder- the buildermanager- the deployment managerport- the port that Undertow should listen on- Returns:
- a new
UndertowServletWebServerinstance
-