Interface RestClientDebugFormatter

All Known Implementing Classes:
BasicRestClientDebugFormatter

public interface RestClientDebugFormatter
Per-tier formatter for JUL-level-driven REST client debug logging.

The client debug pipeline invokes these methods cumulatively based on the resolved logger level:

Since:
10.0.0
  • Method Details

    • formatBasic

      Renders the basic (INFO-tier) portion of a debug record.
      Parameters:
      req - The request.
      res - The response.
      Returns:
      The formatted message chunk.
    • formatHeaders

      Renders the headers (FINE-tier) portion of a debug record.
      Parameters:
      req - The request.
      res - The response.
      Returns:
      The formatted message chunk.
    • formatBody

      Renders the body (FINEST-tier) portion of a debug record.
      Parameters:
      req - The request.
      res - The response.
      Returns:
      The formatted message chunk.
    • bodyCap

      default int bodyCap()
      Maximum number of request/response body bytes to capture for FINEST rendering.
      Returns:
      The capture cap in bytes.
    • isBodyRenderable

      default boolean isBodyRenderable(String contentType)
      Returns true if a body with the given content type is worth rendering as text (as opposed to being binary/unknown).

      This is a text-vs-binary renderability predicate, not a redaction allowlist. It parses only the media type (type/subtype, ignoring parameters such as ; charset=utf-8), case-folds, and treats the following as renderable: text/*, application/json, application/xml, any +json/+xml suffix, and application/x-www-form-urlencoded. multipart/form-data is explicitly non-renderable. An absent or blank content type is conservatively treated as non-renderable.

      Content-Encoding is not visible to this one-argument predicate; a caller that dumps bodies must separately treat any non-identity encoding (e.g. gzip) as non-renderable.

      Keep byte-identical to org.apache.juneau.rest.server.logging.RestDebugFormatter's counterpart.

      Parameters:
      contentType - The body's content type. Can be null (returns false).
      Returns:
      true if the content type is renderable as text.