Package dev.relism.flash.models
Class ResponseSerializer
java.lang.Object
dev.relism.flash.models.ResponseSerializer
The protocol-neutral enumeration of a Scope: excludes
A header added via the raw, fully-pre-rendered
Response's header fields — one source of truth
consumed by every protocol's writer, so field selection cannot drift between HTTP/1 and HTTP/2.
Scope: response-object fields only, not connection framing
Deliberately does not enumerateContent-Length, Connection, or
Date — those are connection/transport framing decisions (body length, keep-alive negotiation,
wall-clock time), not properties of the Response object itself, and HTTP/2 has no
equivalent of Connection at all (RFC 9113 §8.2.2 forbids connection-specific fields in
h2). Each protocol's own writer computes and emits those itself, exactly as
Http1ResponseWriter already did before this class existed.
Scope: excludes Response.header(byte[])'s legacy entries
A header added via the raw, fully-pre-rendered header(byte[]) overload has no recoverable
(name, value) structure — see that method's own Javadoc — so it cannot appear in this
enumeration. HTTP/1 still renders it via Response.writeHeaders(java.io.OutputStream); HTTP/2 cannot recover its
field structure and ignores it.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceOne rendered header field: a byte range for the name, and a byte range for the value — both slices of caller-owned arrays, never copied. -
Method Summary
Modifier and TypeMethodDescriptionstatic voidforEachCustomField(Response response, ResponseSerializer.FieldConsumer consumer) Enumerates structured custom fields only, excludingcontent-type.static voidforEachField(Response response, ResponseSerializer.FieldConsumer consumer) Enumeratesresponse's fields in a fixed order: non-emptyContent-Type, then structured custom fields in call order.static voidforEachTrailerField(Response response, ResponseSerializer.FieldConsumer consumer) Enumerates response trailers in declaration order.
-
Method Details
-
forEachField
Enumeratesresponse's fields in a fixed order: non-emptyContent-Type, then structured custom fields in call order. Every range is a slice of existing response storage. -
forEachCustomField
Enumerates structured custom fields only, excludingcontent-type. -
forEachTrailerField
public static void forEachTrailerField(Response response, ResponseSerializer.FieldConsumer consumer) Enumerates response trailers in declaration order.
-