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 Details

    • AbstractConfigurableWebServerFactory

      public AbstractConfigurableWebServerFactory()
    • AbstractConfigurableWebServerFactory

      public AbstractConfigurableWebServerFactory(int port)
      Create a new AbstractConfigurableWebServerFactory 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 interface ConfigurableWebServerFactory
      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 interface ConfigurableWebServerFactory
      Parameters:
      address - the address to set (defaults to null)
    • getErrorPages

      public Set<ErrorPage> getErrorPages()
      Returns a mutable set of ErrorPages 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 interface ConfigurableWebServerFactory
      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 interface ErrorPageRegistry
      Parameters:
      errorPages - the error pages
    • getSsl

      public Ssl getSsl()
    • 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 interface ConfigurableWebServerFactory
      Parameters:
      ssl - the SSL configuration
    • getSslBundles

      public SslBundles getSslBundles()
      Return the configured SslBundles.
      Returns:
      the SslBundles or null
      Since:
      3.2.0
    • setSslBundles

      public void setSslBundles(SslBundles sslBundles)
      Description copied from interface: ConfigurableWebServerFactory
      Sets the SSL bundles that can be used to configure SSL connections.
      Specified by:
      setSslBundles in interface ConfigurableWebServerFactory
      Parameters:
      sslBundles - the SSL bundles
    • getHttp2

      public Http2 getHttp2()
    • 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 interface ConfigurableWebServerFactory
      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 interface ConfigurableWebServerFactory
      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 interface ConfigurableWebServerFactory
      Parameters:
      serverHeader - the server header value
    • setShutdown

      public void setShutdown(Shutdown shutdown)
      Description copied from interface: ConfigurableWebServerFactory
      Sets the shutdown configuration that will be applied to the server.
      Specified by:
      setShutdown in interface ConfigurableWebServerFactory
      Parameters:
      shutdown - the shutdown configuration
    • getShutdown

      public Shutdown getShutdown()
      Returns the shutdown configuration that will be applied to the server.
      Returns:
      the shutdown configuration
      Since:
      2.3.0
    • getSslBundle

      protected final SslBundle getSslBundle()
      Return the SslBundle that should be used with this server.
      Returns:
      the SSL bundle
    • getServerNameSslBundles

      protected final Map<String,SslBundle> getServerNameSslBundles()
    • 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.