Class AbstractConfigurableWebServerFactory
java.lang.Object
org.springframework.boot.web.server.AbstractConfigurableWebServerFactory
- All Implemented Interfaces:
ConfigurableWebServerFactory
,ErrorPageRegistry
,WebServerFactory
- Direct Known Subclasses:
AbstractReactiveWebServerFactory
,AbstractServletWebServerFactory
public abstract class AbstractConfigurableWebServerFactory
extends Object
implements ConfigurableWebServerFactory
Abstract base class for
ConfigurableWebServerFactory
implementations.- Since:
- 2.0.0
- Author:
- Phillip Webb, Dave Syer, Andy Wilkinson, Stephane Nicoll, Ivan Sopov, EddĂș MelĂ©ndez, Brian Clozel, Scott Frederick
-
Constructor Summary
ConstructorDescriptionCreate a newAbstractConfigurableWebServerFactory
instance.AbstractConfigurableWebServerFactory
(int port) Create a newAbstractConfigurableWebServerFactory
instance with the specified port. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addErrorPages
(ErrorPage... errorPages) Adds error pages that will be used when handling exceptions.protected final File
createTempDir
(String prefix) Return the absolute temp dir for given web server.Return the address that the web server binds to.Returns a mutable set ofErrorPages
that will be used when handling exceptions.getHttp2()
final SslStoreProvider
Deprecated, for removal: This API element is subject to removal in a future version.int
getPort()
The port that the web server listens on.Returns the shutdown configuration that will be applied to the server.getSsl()
protected final SslBundle
Return theSslBundle
that should be used with this server.void
setAddress
(InetAddress address) Sets the specific network address that the server should bind to.void
setCompression
(Compression compression) Sets the compression configuration that will be applied to the server's default connector.void
setErrorPages
(Set<? extends ErrorPage> errorPages) Sets the error pages that will be used when handling exceptions.void
Sets the HTTP/2 configuration that will be applied to the server.void
setPort
(int port) Sets the port that the web server should listen on.void
setServerHeader
(String serverHeader) Sets the server header value.void
setShutdown
(Shutdown shutdown) Sets the shutdown configuration that will be applied to the server.void
Sets the SSL configuration that will be applied to the server's default connector.void
setSslBundles
(SslBundles sslBundles) Sets the SSL bundles that can be used to configure SSL connections.void
setSslStoreProvider
(SslStoreProvider sslStoreProvider) Sets a provider that will be used to obtain SSL stores.
-
Constructor Details
-
AbstractConfigurableWebServerFactory
public AbstractConfigurableWebServerFactory()Create a newAbstractConfigurableWebServerFactory
instance. -
AbstractConfigurableWebServerFactory
public AbstractConfigurableWebServerFactory(int port) Create a newAbstractConfigurableWebServerFactory
instance with the specified port.- Parameters:
port
- the port number for the web server
-
-
Method Details
-
getPort
public int getPort()The port that the web server listens on.- Returns:
- the port
-
setPort
public void setPort(int port) Description copied from interface:ConfigurableWebServerFactory
Sets the port that the web server should listen on. If not specified port '8080' will be used. Use port -1 to disable auto-start (i.e. start the web application context but not have it listen to any port).- Specified by:
setPort
in interfaceConfigurableWebServerFactory
- Parameters:
port
- the port to set
-
getAddress
Return the address that the web server binds to.- Returns:
- the address
-
setAddress
Description copied from interface:ConfigurableWebServerFactory
Sets the specific network address that the server should bind to.- Specified by:
setAddress
in interfaceConfigurableWebServerFactory
- Parameters:
address
- the address to set (defaults tonull
)
-
getErrorPages
Returns a mutable set ofErrorPages
that will be used when handling exceptions.- Returns:
- the error pages
-
setErrorPages
Description copied from interface:ConfigurableWebServerFactory
Sets the error pages that will be used when handling exceptions.- Specified by:
setErrorPages
in interfaceConfigurableWebServerFactory
- Parameters:
errorPages
- the error pages
-
addErrorPages
Description copied from interface:ErrorPageRegistry
Adds error pages that will be used when handling exceptions.- Specified by:
addErrorPages
in interfaceErrorPageRegistry
- Parameters:
errorPages
- the error pages
-
getSsl
-
setSsl
Description copied from interface:ConfigurableWebServerFactory
Sets the SSL configuration that will be applied to the server's default connector.- Specified by:
setSsl
in interfaceConfigurableWebServerFactory
- Parameters:
ssl
- the SSL configuration
-
getSslStoreProvider
-
setSslStoreProvider
Description copied from interface:ConfigurableWebServerFactory
Sets a provider that will be used to obtain SSL stores.- Specified by:
setSslStoreProvider
in interfaceConfigurableWebServerFactory
- Parameters:
sslStoreProvider
- the SSL store provider
-
setSslBundles
Description copied from interface:ConfigurableWebServerFactory
Sets the SSL bundles that can be used to configure SSL connections.- Specified by:
setSslBundles
in interfaceConfigurableWebServerFactory
- Parameters:
sslBundles
- the SSL bundles
-
getHttp2
-
setHttp2
Description copied from interface:ConfigurableWebServerFactory
Sets the HTTP/2 configuration that will be applied to the server.- Specified by:
setHttp2
in interfaceConfigurableWebServerFactory
- Parameters:
http2
- the HTTP/2 configuration
-
getCompression
-
setCompression
Description copied from interface:ConfigurableWebServerFactory
Sets the compression configuration that will be applied to the server's default connector.- Specified by:
setCompression
in interfaceConfigurableWebServerFactory
- Parameters:
compression
- the compression configuration
-
getServerHeader
-
setServerHeader
Description copied from interface:ConfigurableWebServerFactory
Sets the server header value.- Specified by:
setServerHeader
in interfaceConfigurableWebServerFactory
- Parameters:
serverHeader
- the server header value
-
setShutdown
Description copied from interface:ConfigurableWebServerFactory
Sets the shutdown configuration that will be applied to the server.- Specified by:
setShutdown
in interfaceConfigurableWebServerFactory
- Parameters:
shutdown
- the shutdown configuration
-
getShutdown
Returns the shutdown configuration that will be applied to the server.- Returns:
- the shutdown configuration
- Since:
- 2.3.0
-
getOrCreateSslStoreProvider
@Deprecated(since="3.1.0", forRemoval=true) public final SslStoreProvider getOrCreateSslStoreProvider()Deprecated, for removal: This API element is subject to removal in a future version.since 3.1.0 for removal in 3.3.0 in favor ofgetSslBundle()
Return the providedSslStoreProvider
or create one usingSsl
properties.- Returns:
- the
SslStoreProvider
-
getSslBundle
Return theSslBundle
that should be used with this server.- Returns:
- the SSL bundle
-
createTempDir
Return the absolute temp dir for given web server.- Parameters:
prefix
- server name- Returns:
- the temp dir for given server.
-
getSslBundle()