Interface RestDebugBodyScrubber


public interface RestDebugBodyScrubber
Optional operator-supplied transform applied to request/response body text before it is written to a REST debug log.

This SPI is not a default protection. Body dumping is off by default and is enabled only by the JUNEAU_REST_DEBUG_ALLOW_DUMP_BODIES environment-variable master gate. A scrubber only ever runs once that gate has already permitted dumping; it merely chooses scrubbed-vs-raw body text (e.g. mask fields, drop sections). A configured scrubber never causes body content to be emitted while the gate is unset.

The scrubber is fail-closed: if scrub(String, String) throws or returns null, the formatter emits a suppression placeholder instead of the body — it never falls back to the raw, unscrubbed body. A non-null result is still sanitized (control characters escaped) and length-capped before it reaches the log line.

Implementations must be thread-safe — the formatter may invoke scrub(String, String) concurrently.

See Also:
Since:
10.0.0
  • Method Summary

    Modifier and Type
    Method
    Description
    scrub(String contentType, String body)
    Transforms body text before it is logged.
  • Method Details

    • scrub

      String scrub(String contentType, String body)
      Transforms body text before it is logged.
      Parameters:
      contentType - The body's content type (may be null if unknown).
      body - The raw (already byte-capped) body text.
      Returns:
      The scrubbed body text to log, or null to fail closed (the formatter emits a placeholder instead).