Interface WebServer

All Known Implementing Classes:
JettyWebServer, WhiteboardWebServer

public interface WebServer
Web server (HTTP). This service API allows ODL applications to register web components programmatically, instead of using a web.xml declaratively; see the WebContext for why this is preferable.

This API has an OSGi-based as well as a "standalone" implementation suitable e.g. for tests.

Author:
Michael Vorburger.ch
  • Method Details

    • registerWebContext

      Registration registerWebContext(WebContext webContext) throws javax.servlet.ServletException
      Register a new web context.
      Parameters:
      webContext - the web context
      Returns:
      registration which allows to close the context (and remove its servlets etc.)
      Throws:
      javax.servlet.ServletException - if registration of any of the components of the web context failed
    • getBaseURL

      String getBaseURL()
      Get base URL of this web server, without any contexts.

      In production, this would likely be HTTPS with a well known hostname and fixed port configured. For example, in Karaf etc/ configuration file. In tests, this would be typically be HTTP on localhost and an arbitrarily chosen port.

      Returns:
      base URL, with http[s] prefix and port, NOT ending in slash