Class LocalServer

java.lang.Object
io.cloudstub.local.LocalServer
All Implemented Interfaces:
Closeable, AutoCloseable

public final class LocalServer extends Object implements Closeable
The cloudstub-local HTTP server for the secondary management port (REST API + web console).

Serves on a secondary port (default 4567), separate from the AWS mock port. REST API routes:

  • GET /api/status — port, uptime, loaded modules and their stubs, all routes
  • POST /api/reset — clear all state
  • POST /api/reset?service=X — clear state for service X
  • GET /api/history — all captured requests
  • GET /api/history?service=X — requests filtered by service
  • GET /api/openapi.json — OpenAPI 3.0 spec auto-generated from registered routes

It also serves the web console at /console when its assets are bundled (redirecting / to /console/); a headless build runs API-only.

Modules register additional API routes by implementing CloudStubApiService.

  • Constructor Details

  • Method Details

    • start

      public void start() throws IOException
      Throws:
      IOException
    • stop

      public void stop()
    • close

      public void close()
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable
    • port

      public int port()
      The port the API is listening on. When constructed with port 0, this returns the ephemeral port the OS assigned at start() time rather than 0.