Record Class NetworkCaptureOptions

java.lang.Object
java.lang.Record
com.shaft.capture.network.NetworkCaptureOptions
Record Components:
includeAssetTypes - whether stylesheet/script/image/font/media requests are recorded
urlIncludeGlobs - URL glob patterns; when non-empty, only matching URLs are recorded
urlExcludeGlobs - URL glob patterns excluded even when an include glob also matches
firstPartyOnly - whether only same-origin (relative to the initiator page) requests are recorded
maxTransactions - maximum number of transactions recorded per session
maxBodyBytes - maximum number of body bytes persisted per request/response; <= 0 means unlimited
captureRequestBodies - whether request bodies are persisted at all; false records the transaction (method/URL/headers/status) with no request BodyRef
captureResponseBodies - whether response bodies are persisted at all; false records the transaction with no response BodyRef

public record NetworkCaptureOptions(boolean includeAssetTypes, List<String> urlIncludeGlobs, List<String> urlExcludeGlobs, boolean firstPartyOnly, int maxTransactions, long maxBodyBytes, boolean captureRequestBodies, boolean captureResponseBodies) extends Record
Options controlling CaptureNetworkRecorder filtering and body-capture behavior.
  • Field Details

    • DEFAULT_MAX_TRANSACTIONS

      public static final int DEFAULT_MAX_TRANSACTIONS
      Default maximum number of recorded transactions per session.
      See Also:
    • DEFAULT_MAX_BODY_BYTES

      public static final long DEFAULT_MAX_BODY_BYTES
      Default maximum number of persisted body bytes per request/response.
      See Also:
  • Constructor Details

    • NetworkCaptureOptions

      public NetworkCaptureOptions(boolean includeAssetTypes, List<String> urlIncludeGlobs, List<String> urlExcludeGlobs, boolean firstPartyOnly, int maxTransactions, long maxBodyBytes, boolean captureRequestBodies, boolean captureResponseBodies)
      Creates normalized, validated network capture options.
    • NetworkCaptureOptions

      public NetworkCaptureOptions(boolean includeAssetTypes, List<String> urlIncludeGlobs, List<String> urlExcludeGlobs, boolean firstPartyOnly, int maxTransactions, long maxBodyBytes)
      Compatibility constructor for callers that predate captureRequestBodies/ captureResponseBodies (issue #4057): preserves the original unconditional body-capture behavior (subject to maxBodyBytes truncation) by defaulting both new flags to true.
      Parameters:
      includeAssetTypes - whether stylesheet/script/image/font/media requests are recorded
      urlIncludeGlobs - URL glob patterns; when non-empty, only matching URLs are recorded
      urlExcludeGlobs - URL glob patterns excluded even when an include glob also matches
      firstPartyOnly - whether only same-origin (relative to the initiator page) requests are recorded
      maxTransactions - maximum number of transactions recorded per session
      maxBodyBytes - maximum number of body bytes persisted per request/response; <= 0 means unlimited
  • Method Details

    • defaults

      public static NetworkCaptureOptions defaults()
      Returns default network capture options: no asset types, no glob filters, first-party only, capped at 500 transactions.
      Returns:
      default network capture options
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with the compare method from their corresponding wrapper classes.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • includeAssetTypes

      public boolean includeAssetTypes()
      Returns the value of the includeAssetTypes record component.
      Returns:
      the value of the includeAssetTypes record component
    • urlIncludeGlobs

      public List<String> urlIncludeGlobs()
      Returns the value of the urlIncludeGlobs record component.
      Returns:
      the value of the urlIncludeGlobs record component
    • urlExcludeGlobs

      public List<String> urlExcludeGlobs()
      Returns the value of the urlExcludeGlobs record component.
      Returns:
      the value of the urlExcludeGlobs record component
    • firstPartyOnly

      public boolean firstPartyOnly()
      Returns the value of the firstPartyOnly record component.
      Returns:
      the value of the firstPartyOnly record component
    • maxTransactions

      public int maxTransactions()
      Returns the value of the maxTransactions record component.
      Returns:
      the value of the maxTransactions record component
    • maxBodyBytes

      public long maxBodyBytes()
      Returns the value of the maxBodyBytes record component.
      Returns:
      the value of the maxBodyBytes record component
    • captureRequestBodies

      public boolean captureRequestBodies()
      Returns the value of the captureRequestBodies record component.
      Returns:
      the value of the captureRequestBodies record component
    • captureResponseBodies

      public boolean captureResponseBodies()
      Returns the value of the captureResponseBodies record component.
      Returns:
      the value of the captureResponseBodies record component