Skip to content

Commit cc99c62

Browse files
committed
docs: Note how to add a content coding
Records the extension points for anyone who wants zstd or brotli, and why deflate is not worth adding.
1 parent 15d4953 commit cc99c62

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -523,6 +523,16 @@ advertising the uncoded length.
523523
renderer and are well under any sensible threshold
524524
- per-route or per-operation opt-out
525525

526+
**Adding a coding (e.g. zstd).** Neither brotli nor zstd is in the JDK, so either needs a
527+
dependency — declare it `optional` so consumers inherit nothing, and detect it with a
528+
`Class.forName` probe the way Gson is detected. `deflate` needs no dependency but is only ~12 bytes
529+
better than gzip on any payload, which is why it is not here. The four extension points are
530+
`ContentEncodingHeader.Coding` (request codings), `RequestBodyReader.inflate` (decode),
531+
`ResponseCompression` (encode) and the `Content-Encoding` the renderer sets. The one real change is
532+
`AcceptEncodingHeader.acceptsGzip`, which answers a yes/no question and would have to return the
533+
client's highest-weighted supported coding instead — the q-value parsing it already does is what
534+
that ordering needs.
535+
526536
### Graceful shutdown
527537

528538
`OpenApiServer` exposes `stop(int delaySeconds)` for explicit shutdown that waits up to the given

0 commit comments

Comments
 (0)