Class TerminalViewEndpoints

java.lang.Object
org.apache.juneau.console.views.TerminalViewEndpoints

public final class TerminalViewEndpoints extends Object
Static helpers that implement the terminal-view events endpoint.

TerminalViewMixin delegates to these; an application that wants its own path writes one @RestGet method that calls events(Optional, RestRequest, RestResponse) and gets the same validation, cap and headers.

  • Field Details

  • Method Details

    • checkRunId

      public static String checkRunId(String runId)
      Checks a mixin runId against ^[A-Za-z0-9_-]{1,128}$.
      Parameters:
      runId - The run id from the URL path.
      Returns:
      The same id.
      Throws:
      BadRequest - If the id does not match.
    • events

      public static void events(Optional<TerminalViewSource> source, RestRequest req, RestResponse res) throws IOException
      Serves one page of the events endpoint (?after=) as JSON.

      Answers 404 for an empty source, 400 for a malformed after, 410 Gone for an unknown or stale token, and otherwise 200 with Cache-Control: no-store.

      Parameters:
      source - The resolved source; empty answers 404.
      req - The request.
      res - The response.
      Throws:
      IOException - If the response could not be written.