Class UnparsedRequest
Request could be constructed.
The built-in HTTP and SSE transports retain at most 64 KiB of wire input
attributed to the rejected request through its rejection boundary. For parsing
failures this is the parser-proven boundary; for a partial read timeout it is
the end of the received input. HTTP validation failures after parsing (such as
invalid URI encoding or body decompression failures) report the observed wire
count with an empty capture and a truncated flag, without retaining another
raw copy of every successfully parsed request.
getObservedByteCount() reports the number of attributed bytes through
that boundary, while isCaptureTruncated() indicates whether the
retained prefix omits any of those bytes. Bytes already read from the socket
beyond the boundary are not counted because they might belong to a pipelined
request. Captured bytes are untrusted and may contain credentials or other
sensitive values; applications should apply their own redaction and retention
policies before logging or storing them.
Diagnostic rendering intentionally omits both captured bytes and the remote address.
- Author:
- Mark Allen
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classBuilder used to construct an immutableUnparsedRequest. -
Method Summary
Modifier and TypeMethodDescriptionbooleanReturns the retained prefix of exact wire bytes attributed to the rejected request through the rejection boundary.Returns the number of wire bytes attributed to this rejected request through the rejection boundary.Returns the best-effort remote network address for the rejected request.inthashCode()Indicates whethergetCapturedBytes()is an incomplete prefix of the wire input attributed to the rejected request through its rejection boundary.toString()static @NonNull UnparsedRequest.BuilderwithServerTypeAndReason(@NonNull ServerType serverType, @NonNull UnparsedRequestReason reason) Acquires a builder for an unparsed request.
-
Method Details
-
withServerTypeAndReason
public static @NonNull UnparsedRequest.Builder withServerTypeAndReason(@NonNull ServerType serverType, @NonNull UnparsedRequestReason reason) Acquires a builder for an unparsed request.- Parameters:
serverType- the type of server that rejected the incoming bytesreason- the typed reason no valid request could be constructed- Returns:
- an unparsed-request builder
- Throws:
NullPointerException- if an argument isnull
-
getServerType
- Returns:
- the type of server that rejected the incoming bytes
-
getReason
- Returns:
- the typed reason no valid request could be constructed
-
getRemoteAddress
Returns the best-effort remote network address for the rejected request.- Returns:
- the remote address, or
Optional.empty()if unavailable
-
getCapturedBytes
Returns the retained prefix of exact wire bytes attributed to the rejected request through the rejection boundary.Each invocation returns a fresh read-only view with position
0and no accessible backing array.- Returns:
- a fresh read-only view of the captured byte prefix
-
getObservedByteCount
Returns the number of wire bytes attributed to this rejected request through the rejection boundary. This can be larger than the number returned byBuffer.remaining()ongetCapturedBytes().The value does not include bytes already read from the socket beyond that boundary because they might belong to a pipelined request.
- Returns:
- the attributed wire-byte count through the failure boundary
-
isCaptureTruncated
Indicates whethergetCapturedBytes()is an incomplete prefix of the wire input attributed to the rejected request through its rejection boundary.- Returns:
trueif captured bytes were truncated
-
equals
-
hashCode
-
toString
-