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 forConfigurableWebServerFactory
implementations.- Since:
- 2.0.0
Constructor Summary
Constructors Constructor Description AbstractConfigurableWebServerFactory()
Create a newAbstractConfigurableWebServerFactory
instance.AbstractConfigurableWebServerFactory(int port)
Create a newAbstractConfigurableWebServerFactory
instance with the specified port.
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addErrorPages(ErrorPage... errorPages)
Adds error pages that will be used when handling exceptions.protected File
createTempDir(String prefix)
Return the absolute temp dir for given web server.InetAddress
getAddress()
Return the address that the web server binds to.Compression
getCompression()
Set<ErrorPage>
getErrorPages()
Returns a mutable set ofErrorPages
that will be used when handling exceptions.Http2
getHttp2()
int
getPort()
The port that the web server listens on.String
getServerHeader()
Ssl
getSsl()
SslStoreProvider
getSslStoreProvider()
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
setHttp2(Http2 http2)
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
setSsl(Ssl ssl)
Sets the SSL configuration that will be applied to the server's default connector.void
setSslStoreProvider(SslStoreProvider sslStoreProvider)
Sets a provider that will be used to obtain SSL stores.
Constructor Detail
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 Detail
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
public InetAddress getAddress()
Return the address that the web server binds to.- Returns:
- the address
setAddress
public void setAddress(InetAddress address)
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
public Set<ErrorPage> getErrorPages()
Returns a mutable set ofErrorPages
that will be used when handling exceptions.- Returns:
- the error pages
setErrorPages
public void setErrorPages(Set<? extends ErrorPage> errorPages)
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
public void addErrorPages(ErrorPage... errorPages)
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
setSsl
public void setSsl(Ssl ssl)
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
public SslStoreProvider getSslStoreProvider()
setSslStoreProvider
public void setSslStoreProvider(SslStoreProvider sslStoreProvider)
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
setHttp2
public void setHttp2(Http2 http2)
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
public Compression getCompression()
setCompression
public void setCompression(Compression compression)
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
public String getServerHeader()
setServerHeader
public void setServerHeader(String serverHeader)
Description copied from interface:ConfigurableWebServerFactory
Sets the server header value.- Specified by:
setServerHeader
in interfaceConfigurableWebServerFactory
- Parameters:
serverHeader
- the server header value
createTempDir
protected final File createTempDir(String prefix)
Return the absolute temp dir for given web server.- Parameters:
prefix
- server name- Returns:
- the temp dir for given server.