Docs / API / Server

Server & boot

com.s8.meta.api.server

An S8 process is a web server plus the boot methods that paint the first screens. The factory builds the server from an XML config path, a boot-layer origin class (used to locate the module), and a parameter setter. Validate that XML against schema.xsd.

S8BootMethod

A functional interface. The constant MAIN_BOOT_PAGE is "/".

boot(flow)
Called with a fresh flow when that path is hit. void boot(S8SyncFlow flow) throws Exception

S8WebServerFactory

Created for you as S8.WEB_SERVER_FACTORY.

createWebServer(configPathname, bootLayerOrigin, setup)
Build a server. bootLayerOrigin is typically LaunchServer.class.

S8WebServer

start()
Bind and run. void start() throws Exception

Parameters

S8WebServerParameters.addBootMethod(String path, S8BootMethod method) registers a boot handler. Multiple paths are allowed; / is the home screen.

Example

LaunchServer.java
public class LaunchServer {
  public static void main(String[] args) throws Exception {
    S8WebServer server = S8.WEB_SERVER_FACTORY.createWebServer(
        "/path/to/app-config.xml",
        LaunchServer.class,
        params -> params.addBootMethod(S8BootMethod.MAIN_BOOT_PAGE, AppBoot.INSTANCE));
    server.start();
  }
}
Intent Boot methods replace both a router and a first-paint controller. After boot, inbound front methods keep the app alive.