Class DashboardBodyCap

java.lang.Object
org.mockserver.dashboard.model.DashboardBodyCap

public final class DashboardBodyCap extends Object
Shortens the bodies the dashboard sends in its live updates. A row carries its exchange's bodies about eight times over, so uncapped bodies make an update hundreds of megabytes; the dashboard loads a full body on demand (GET /mockserver/logEntryBody). Sizes are in characters of the body as the dashboard shows it.
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static final class 
    Renders one log entry's bodies for the dashboard: a body already cut for an earlier row under the same variant (with redaction on, its redacted rendering) comes back as that cut text without being decoded again.
    static final class 
    What capping one log entry's messages found: each cut copy's full body length, and roughly how many characters the entry adds to an update.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final int
     
    static final int
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static long
    capExpectationTree(com.fasterxml.jackson.databind.JsonNode node)
    Cuts, in place, an expectation's serialised tree for the dashboard's expectations section: every body longer than the cap (a JSON or binary body is measured and cut as its serialised text) and every other string longer than the cap.
    static Map<String,Object>
    expectationTruncationMarker(String expectationId, long originalLength)
    What the dashboard needs to say an expectation in its expectations section was cut, and to load it whole by id.
    static Map<String,Object>
    truncationMarker(String logEntryId, Object message, long originalLength, boolean loadable)
    What the dashboard needs to say a body was cut and to load it whole: the log entry it belongs to, which of the entry's messages it is, and the full and shown lengths.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • MAX_BODY_CHARACTERS

      public static final int MAX_BODY_CHARACTERS
      See Also:
    • MESSAGE_OVERHEAD_CHARACTERS

      public static final int MESSAGE_OVERHEAD_CHARACTERS
      See Also:
  • Method Details

    • truncationMarker

      public static Map<String,Object> truncationMarker(String logEntryId, Object message, long originalLength, boolean loadable)
      What the dashboard needs to say a body was cut and to load it whole: the log entry it belongs to, which of the entry's messages it is, and the full and shown lengths.
    • capExpectationTree

      public static long capExpectationTree(com.fasterxml.jackson.databind.JsonNode node)
      Cuts, in place, an expectation's serialised tree for the dashboard's expectations section: every body longer than the cap (a JSON or binary body is measured and cut as its serialised text) and every other string longer than the cap. Returns the longest original length cut, or 0 when nothing was cut. The dashboard loads the whole expectation by id before editing it, so a cut tree is only ever shown.
    • expectationTruncationMarker

      public static Map<String,Object> expectationTruncationMarker(String expectationId, long originalLength)
      What the dashboard needs to say an expectation in its expectations section was cut, and to load it whole by id.