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.
UndertowServletWebServer
logger
Constructor and Description |
---|
UndertowServletWebServerFactory()
Create a new
UndertowServletWebServerFactory instance. |
UndertowServletWebServerFactory(int port)
Create a new
UndertowServletWebServerFactory that listens for requests
using the specified port. |
UndertowServletWebServerFactory(java.lang.String contextPath,
int port)
Create a new
UndertowServletWebServerFactory with the specified context
path and port. |
Modifier and Type | Method and Description |
---|---|
void |
addBuilderCustomizers(UndertowBuilderCustomizer... customizers)
Add
UndertowBuilderCustomizer s that should be used to customize the
Undertow Undertow.Builder . |
void |
addDeploymentInfoCustomizers(UndertowDeploymentInfoCustomizer... customizers)
Add
UndertowDeploymentInfoCustomizer s that should be used to customize the
Undertow DeploymentInfo . |
java.lang.String |
getAccessLogPrefix() |
java.util.Collection<UndertowBuilderCustomizer> |
getBuilderCustomizers()
Returns a mutable collection of the
UndertowBuilderCustomizer s that will be
applied to the Undertow Undertow.Builder . |
java.util.Collection<UndertowDeploymentInfoCustomizer> |
getDeploymentInfoCustomizers()
Returns a mutable collection of the
UndertowDeploymentInfoCustomizer s that
will be applied to the Undertow DeploymentInfo . |
protected UndertowServletWebServer |
getUndertowWebServer(io.undertow.Undertow.Builder builder,
io.undertow.servlet.api.DeploymentManager manager,
int port)
Factory method called to create the
UndertowServletWebServer . |
WebServer |
getWebServer(ServletContextInitializer... initializers)
Gets a new fully configured but paused
WebServer instance. |
boolean |
isAccessLogEnabled() |
boolean |
isEagerFilterInit()
Return if filters should be eagerly initialized.
|
boolean |
isPreservePathOnForward()
Return whether the request path should be preserved on forward.
|
protected boolean |
isUseForwardHeaders() |
void |
setAccessLogDirectory(java.io.File accessLogDirectory)
Set the access log directory.
|
void |
setAccessLogEnabled(boolean accessLogEnabled)
Set whether access logs are enabled.
|
void |
setAccessLogPattern(java.lang.String accessLogPattern)
Set the access log pattern.
|
void |
setAccessLogPrefix(java.lang.String accessLogPrefix)
Set the access log prefix.
|
void |
setAccessLogRotate(boolean accessLogRotate)
Set whether access logs rotation is enabled.
|
void |
setAccessLogSuffix(java.lang.String accessLogSuffix)
Set the access log suffix.
|
void |
setBufferSize(java.lang.Integer bufferSize)
Set the buffer size.
|
void |
setBuilderCustomizers(java.util.Collection<? extends UndertowBuilderCustomizer> customizers)
Set
UndertowBuilderCustomizer s that should be applied to the Undertow
Undertow.Builder . |
void |
setDeploymentInfoCustomizers(java.util.Collection<? extends UndertowDeploymentInfoCustomizer> customizers)
Set
UndertowDeploymentInfoCustomizer s that should be applied to the
Undertow DeploymentInfo . |
void |
setEagerFilterInit(boolean eagerFilterInit)
Set whether filters should be eagerly initialized.
|
void |
setIoThreads(java.lang.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(java.lang.Boolean directBuffers)
Set whether direct buffers should be used.
|
void |
setUseForwardHeaders(boolean useForwardHeaders)
Set if x-forward-* headers should be processed.
|
void |
setWorkerThreads(java.lang.Integer workerThreads)
Set the number of Worker Threads.
|
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
addErrorPages, createTempDir, getAddress, getCompression, getErrorPages, getHttp2, getPort, getServerHeader, getShutdown, getSsl, getSslStoreProvider, setAddress, setCompression, setErrorPages, setHttp2, setPort, setServerHeader, setShutdown, setSsl, setSslStoreProvider
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
setAddress, setCompression, setErrorPages, setHttp2, setPort, setServerHeader, setShutdown, setSsl, setSslStoreProvider
addErrorPages
public UndertowServletWebServerFactory()
UndertowServletWebServerFactory
instance.public UndertowServletWebServerFactory(int port)
UndertowServletWebServerFactory
that listens for requests
using the specified port.port
- the port to listen onpublic UndertowServletWebServerFactory(java.lang.String contextPath, int port)
UndertowServletWebServerFactory
with the specified context
path and port.contextPath
- the root context pathport
- the port to listen onpublic void setBuilderCustomizers(java.util.Collection<? extends UndertowBuilderCustomizer> customizers)
ConfigurableUndertowWebServerFactory
UndertowBuilderCustomizer
s that should be applied to the Undertow
Undertow.Builder
. Calling this method will replace any existing customizers.setBuilderCustomizers
in interface ConfigurableUndertowWebServerFactory
customizers
- the customizers to setpublic void addBuilderCustomizers(UndertowBuilderCustomizer... customizers)
ConfigurableUndertowWebServerFactory
UndertowBuilderCustomizer
s that should be used to customize the
Undertow Undertow.Builder
.addBuilderCustomizers
in interface ConfigurableUndertowWebServerFactory
customizers
- the customizers to addpublic java.util.Collection<UndertowBuilderCustomizer> getBuilderCustomizers()
UndertowBuilderCustomizer
s that will be
applied to the Undertow Undertow.Builder
.public void setBufferSize(java.lang.Integer bufferSize)
ConfigurableUndertowWebServerFactory
setBufferSize
in interface ConfigurableUndertowWebServerFactory
bufferSize
- buffer sizepublic void setIoThreads(java.lang.Integer ioThreads)
ConfigurableUndertowWebServerFactory
setIoThreads
in interface ConfigurableUndertowWebServerFactory
ioThreads
- number of IO Threadspublic void setWorkerThreads(java.lang.Integer workerThreads)
ConfigurableUndertowWebServerFactory
setWorkerThreads
in interface ConfigurableUndertowWebServerFactory
workerThreads
- number of Worker Threadspublic void setUseDirectBuffers(java.lang.Boolean directBuffers)
ConfigurableUndertowWebServerFactory
setUseDirectBuffers
in interface ConfigurableUndertowWebServerFactory
directBuffers
- whether direct buffers should be usedpublic void setAccessLogDirectory(java.io.File accessLogDirectory)
ConfigurableUndertowWebServerFactory
setAccessLogDirectory
in interface ConfigurableUndertowWebServerFactory
accessLogDirectory
- access log directorypublic void setAccessLogPattern(java.lang.String accessLogPattern)
ConfigurableUndertowWebServerFactory
setAccessLogPattern
in interface ConfigurableUndertowWebServerFactory
accessLogPattern
- access log patternpublic void setAccessLogPrefix(java.lang.String accessLogPrefix)
ConfigurableUndertowWebServerFactory
setAccessLogPrefix
in interface ConfigurableUndertowWebServerFactory
accessLogPrefix
- log prefixpublic java.lang.String getAccessLogPrefix()
public void setAccessLogSuffix(java.lang.String accessLogSuffix)
ConfigurableUndertowWebServerFactory
setAccessLogSuffix
in interface ConfigurableUndertowWebServerFactory
accessLogSuffix
- access log suffixpublic void setAccessLogEnabled(boolean accessLogEnabled)
ConfigurableUndertowWebServerFactory
setAccessLogEnabled
in interface ConfigurableUndertowWebServerFactory
accessLogEnabled
- whether access logs are enabledpublic boolean isAccessLogEnabled()
public void setAccessLogRotate(boolean accessLogRotate)
ConfigurableUndertowWebServerFactory
setAccessLogRotate
in interface ConfigurableUndertowWebServerFactory
accessLogRotate
- whether access logs rotation is enabledpublic void setUseForwardHeaders(boolean useForwardHeaders)
ConfigurableUndertowWebServerFactory
setUseForwardHeaders
in interface ConfigurableUndertowWebServerFactory
useForwardHeaders
- if x-forward headers should be usedprotected final boolean isUseForwardHeaders()
public void setDeploymentInfoCustomizers(java.util.Collection<? extends UndertowDeploymentInfoCustomizer> customizers)
UndertowDeploymentInfoCustomizer
s that should be applied to the
Undertow DeploymentInfo
. Calling this method will replace any existing
customizers.customizers
- the customizers to setpublic void addDeploymentInfoCustomizers(UndertowDeploymentInfoCustomizer... customizers)
UndertowDeploymentInfoCustomizer
s that should be used to customize the
Undertow DeploymentInfo
.customizers
- the customizers to addpublic java.util.Collection<UndertowDeploymentInfoCustomizer> getDeploymentInfoCustomizers()
UndertowDeploymentInfoCustomizer
s that
will be applied to the Undertow DeploymentInfo
.public void setResourceLoader(org.springframework.core.io.ResourceLoader resourceLoader)
setResourceLoader
in interface org.springframework.context.ResourceLoaderAware
public boolean isEagerFilterInit()
true
if filters are eagerly initialized, otherwise false
.public void setEagerFilterInit(boolean eagerFilterInit)
eagerFilterInit
- true
if filters are eagerly initialized, otherwise
false
.public boolean isPreservePathOnForward()
true
if the path should be preserved when a request is forwarded,
otherwise false
.public void setPreservePathOnForward(boolean preservePathOnForward)
preservePathOnForward
- true
if the path should be preserved when a
request is forwarded, otherwise false
.public WebServer getWebServer(ServletContextInitializer... initializers)
ServletWebServerFactory
WebServer
instance. Clients should
not be able to connect to the returned server until WebServer.start()
is
called (which happens when the ApplicationContext
has been fully
refreshed).getWebServer
in interface ServletWebServerFactory
initializers
- ServletContextInitializer
s that should be applied as
the server startsWebServer
WebServer.stop()
protected UndertowServletWebServer getUndertowWebServer(io.undertow.Undertow.Builder builder, io.undertow.servlet.api.DeploymentManager manager, int port)
UndertowServletWebServer
. Subclasses
can override this method to return a different UndertowServletWebServer
or
apply additional processing to the Undertow.Builder
and DeploymentManager
used to bootstrap Undertowbuilder
- the buildermanager
- the deployment managerport
- the port that Undertow should listen onUndertowServletWebServer
instance