Class DashboardRest

java.lang.Object
jakarta.servlet.GenericServlet
All Implemented Interfaces:
jakarta.servlet.Servlet, jakarta.servlet.ServletConfig, Serializable, BasicUniversalConfig, DefaultConfig, DefaultHtmlConfig

public class DashboardRest extends PetstoreConsolePage
Dashboard: the dashboard-chrome demo page, built with DevPageBuilders.dashboard(String, int) only.

?variant= picks how the orders source behaves (ok, slow, truncated or error; right behaves as ok and puts the rail on the right) and ?v= sets the persist version. /series/<variant> serves one CSV row per UTC day in [start, end), filtered by reasons, q and lateOnly; /requests counts the series requests, so a test can see Refresh and Clear cache reach the server.

Example:

GET /console/dev/dashboard?variant=slow GET /console/dev/dashboard/series/ok?start=2026-10-01T00:00:00Z&end=2026-10-08T00:00:00Z&reasons=late

See Also:
  • Constructor Details

  • Method Details

    • page

      public View page(RestRequest req, @Query("variant") String variant, @Query("v") Integer v)
      Renders the Dashboard page.
      Parameters:
      req - The request.
      variant - The source variant; anything unknown is ok.
      v - The persist version; below 1 (or absent) is 1.
      Returns:
      The page.
    • series

      public void series(RestRequest req, RestResponse res, @Path("variant") String variant, @Query("q") @Schema(aev=true) String q, @Query("start") String start, @Query("end") String end, @Query("lateOnly") String lateOnly) throws IOException
      The orders source: day,reason,orders, one row per UTC day.
      Parameters:
      req - The request (for the repeated reasons parameter).
      res - The response.
      variant - ok, slow (half the rows, a pause, the rest), truncated (at most 20 rows and the #truncated,20 sentinel) or error (a 500).
      q - Keeps rows whose reason contains this text, case-insensitively; empty keeps every row.
      start - The window start, ISO-8601; defaults to 30 days before end.
      end - The window end, ISO-8601, exclusive; defaults to the start of tomorrow (UTC).
      lateOnly - true keeps only late.
      Throws:
      IOException - If the response can't be written.
    • reasons

      public List<JsonMap> reasons()
      Orders by reason over a fixed 28 days, for the by-reason bar and the share donut.
      Returns:
      One row per reason.
    • weekdays

      public List<JsonMap> weekdays()
      Orders by weekday over the same fixed 28 days, for the by-weekday bar.
      Returns:
      One row per weekday, Monday first.
    • requests

      public JsonMap requests()
      The series request counter.
      Returns:
      {series: n}.
    • script

      public void script(RestResponse res) throws IOException
      Serves the page-local script (the petstore.late rail section).
      Parameters:
      res - The response.
      Throws:
      IOException - If the bundled script can't be read.