ServerRefusals

class ServerRefusals(limits: ServerRefusals.Limits) : ChannelDuplexHandler

The server's own refusals as problems (#6956): a request Reactor Netty cannot decode, a request line or a header block past its limit or malformed HTTP, is answered by it before any route runs, with its status (414, 431 or 400) and an empty body. This handler gives that answer a problem's body, status alone as the 413 of a body past the codecs' limit is (tooLargeProblem), its detail naming the limit and the key that sets it (limits).

It recognises the refusal by its cause, not its shape. Sitting before Reactor Netty's traffic handler, it sees each request on its way in; while the traffic handler handles one whose decoding failed, it rewrites the response written then, which is Reactor Netty's answer to it: Reactor Netty writes it at once, on the channel's event loop (HttpServerOperations.sendDecodingFailures). A route's response is written outside that, so it is never rewritten, however it looks.

Constructors

Link copied to clipboard
constructor(limits: ServerRefusals.Limits)

Types

Link copied to clipboard
Link copied to clipboard
class Limits(val requestLine: String, val headers: String)

How the server's limits read in a refusal's detail: each its size and the key that sets it, if any.

Functions

Link copied to clipboard
open override fun channelRead(ctx: ChannelHandlerContext, msg: Any)
Link copied to clipboard
open override fun write(ctx: ChannelHandlerContext, msg: Any, promise: ChannelPromise)