Package org.apache.juneau.rest.client
Class BasicRestClientDebugFormatter
java.lang.Object
org.apache.juneau.rest.client.BasicRestClientDebugFormatter
- All Implemented Interfaces:
RestClientDebugFormatter
Default
RestClientDebugFormatter implementation — secure by default.
Request/response bodies are never dumped by default; dumping is a deliberate operator opt-in behind the
JUNEAU_REST_DEBUG_ALLOW_DUMP_BODIES environment-variable master gate, mirroring
org.apache.juneau.rest.server.logging.BasicRestDebugFormatter's server-side contract. See
bodyScrubber(RestDebugBodyScrubber) and RestClientDebugFormatter.isBodyRenderable(String) for the
rest of the pipeline.
- Since:
- 10.0.0
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected intThe body capture cap in bytes.protected RestDebugBodyScrubberOptional body scrubber applied to body text when the master gate is set.static final intDefault body capture cap, in bytes (8 KB).The set of header names whose values are masked. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintbodyCap()Maximum number of request/response body bytes to capture forFINESTrendering.bodyCap(int value) Overrides the body capture cap.Sets the body scrubber applied to body text when theJUNEAU_REST_DEBUG_ALLOW_DUMP_BODIESgate is set.formatBasic(RestRequest req, RestResponse res) Renders the basic (INFO-tier) portion of a debug record.formatBody(RestRequest req, RestResponse res) Renders the body (FINEST-tier) portion of a debug record.formatHeaders(RestRequest req, RestResponse res) Renders the headers (FINE-tier) portion of a debug record.redactedHeaders(Collection<String> value) Overrides the redacted-header set.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.juneau.rest.client.RestClientDebugFormatter
isBodyRenderable
-
Field Details
-
DEFAULT_BODY_CAP
Default body capture cap, in bytes (8 KB).- See Also:
-
redactedHeaders
The set of header names whose values are masked. -
bodyScrubber
Optional body scrubber applied to body text when the master gate is set. -
bodyCap
The body capture cap in bytes.
-
-
Constructor Details
-
BasicRestClientDebugFormatter
public BasicRestClientDebugFormatter()Constructor.
-
-
Method Details
-
redactedHeaders
Overrides the redacted-header set.- Parameters:
value- The new set of header names to mask.- Returns:
- This object.
-
bodyScrubber
Sets the body scrubber applied to body text when theJUNEAU_REST_DEBUG_ALLOW_DUMP_BODIESgate is set.The scrubber only ever runs once dumping is already permitted by the gate; it chooses scrubbed-vs-raw body text. It is fail-closed: a throw or a
null return yields a placeholder, never the raw body.- Parameters:
value- The scrubber, ornull for none (the default, which dumps raw when gated).- Returns:
- This object.
-
bodyCap
Overrides the body capture cap.- Parameters:
value- The new cap in bytes.- Returns:
- This object.
-
bodyCap
Description copied from interface:RestClientDebugFormatterMaximum number of request/response body bytes to capture forFINESTrendering.- Specified by:
bodyCapin interfaceRestClientDebugFormatter- Returns:
- The capture cap in bytes.
-
formatBasic
Description copied from interface:RestClientDebugFormatterRenders the basic (INFO-tier) portion of a debug record.- Specified by:
formatBasicin interfaceRestClientDebugFormatter- Parameters:
req- The request.res- The response.- Returns:
- The formatted message chunk.
-
formatHeaders
Description copied from interface:RestClientDebugFormatterRenders the headers (FINE-tier) portion of a debug record.- Specified by:
formatHeadersin interfaceRestClientDebugFormatter- Parameters:
req- The request.res- The response.- Returns:
- The formatted message chunk.
-
formatBody
Description copied from interface:RestClientDebugFormatterRenders the body (FINEST-tier) portion of a debug record.- Specified by:
formatBodyin interfaceRestClientDebugFormatter- Parameters:
req- The request.res- The response.- Returns:
- The formatted message chunk.
-