Interface WebServerApplicationContext

All Superinterfaces:
ApplicationContext, ApplicationEventPublisher, BeanFactory, EnvironmentCapable, HierarchicalBeanFactory, ListableBeanFactory, MessageSource, ResourceLoader, ResourcePatternResolver
All Known Subinterfaces:
ConfigurableWebServerApplicationContext
All Known Implementing Classes:
AnnotationConfigReactiveWebServerApplicationContext, AnnotationConfigServletWebServerApplicationContext, ReactiveWebServerApplicationContext, ServletWebServerApplicationContext, XmlServletWebServerApplicationContext

public interface WebServerApplicationContext extends ApplicationContext
Interface to be implemented by application contexts that create and manage the lifecycle of an embedded WebServer.
Since:
2.0.0
Author:
Phillip Webb
  • Method Details

    • getWebServer

      WebServer getWebServer()
      Returns the WebServer that was created by the context or null if the server has not yet been created.
      Returns:
      the web server
    • getServerNamespace

      String getServerNamespace()
      Returns the namespace of the web server application context or null if no namespace has been set. Used for disambiguation when multiple web servers are running in the same application (for example a management context running on a different port).
      Returns:
      the server namespace
    • hasServerNamespace

      static boolean hasServerNamespace(ApplicationContext context, String serverNamespace)
      Returns true if the specified context is a WebServerApplicationContext with a matching server namespace.
      Parameters:
      context - the context to check
      serverNamespace - the server namespace to match against
      Returns:
      true if the server namespace of the context matches
      Since:
      2.1.8
    • getServerNamespace

      static String getServerNamespace(ApplicationContext context)
      Returns the server namespace if the specified context is a WebServerApplicationContext.
      Parameters:
      context - the context
      Returns:
      the server namespace or null if the context is not a WebServerApplicationContext
      Since:
      2.6.0