Class UnparsedRequest.Builder
java.lang.Object
com.soklet.UnparsedRequest.Builder
- Enclosing class:
UnparsedRequest
Builder used to construct an immutable
UnparsedRequest.
This class is intended for use by a single thread.
- Author:
- Mark Allen
-
Method Summary
Modifier and TypeMethodDescriptionbuild()Builds an immutable unparsed-request snapshot.capturedBytes(byte @NonNull [] capturedBytes) Sets the retained prefix of exact wire bytes attributed to the rejected request through its failure boundary.captureTruncated(@NonNull Boolean captureTruncated) Specifies whether the captured bytes are an incomplete prefix of the wire input attributed to the rejected request through its failure boundary.observedByteCount(@NonNull Long observedByteCount) Sets the number of wire bytes attributed to this rejected request through its failure boundary.remoteAddress(@Nullable InetSocketAddress remoteAddress) Sets the best-effort remote network address.
-
Method Details
-
remoteAddress
Sets the best-effort remote network address. Passingnullclears any previously configured address.- Parameters:
remoteAddress- the remote address, ornullif unavailable- Returns:
- this builder
-
capturedBytes
Sets the retained prefix of exact wire bytes attributed to the rejected request through its failure boundary. The bytes are defensively copied whenbuild()is invoked.- Parameters:
capturedBytes- captured wire-byte prefix- Returns:
- this builder
- Throws:
NullPointerException- ifcapturedBytesisnull
-
observedByteCount
Sets the number of wire bytes attributed to this rejected request through its failure boundary.- Parameters:
observedByteCount- attributed wire-byte count through the failure boundary- Returns:
- this builder
- Throws:
NullPointerException- ifobservedByteCountisnullIllegalArgumentException- if the count is negative
-
captureTruncated
Specifies whether the captured bytes are an incomplete prefix of the wire input attributed to the rejected request through its failure boundary.- Parameters:
captureTruncated-trueif the capture is incomplete- Returns:
- this builder
- Throws:
NullPointerException- ifcaptureTruncatedisnull
-
build
Builds an immutable unparsed-request snapshot.- Returns:
- an immutable unparsed request
- Throws:
IllegalArgumentException- if captured-byte metadata is inconsistent
-