File tree Expand file tree Collapse file tree
src/main/java/com/retailsvc/http Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ package com .retailsvc .http ;
2+
3+ /**
4+ * Callback invoked after an HTTP response has been written to the client. Runs on the same virtual
5+ * thread that handled the request, inside the library's request {@link ScopedValue} binding.
6+ *
7+ * <p>Hooks fire only when a {@link Request} was successfully constructed — i.e., routing and
8+ * parameter/body validation passed. Pre-request failures (404, 405, 400 validation) do not fire
9+ * hooks.
10+ *
11+ * <p>On the error path, {@link Response#body()} is always {@code null} because the body bytes have
12+ * already been sent. {@link Response#status()} and {@link Response#headers()} reflect what was
13+ * written to the wire.
14+ *
15+ * <p>Exceptions thrown by a hook are logged at DEBUG and swallowed; subsequent hooks still run.
16+ * Hooks compose in registration order.
17+ */
18+ @ FunctionalInterface
19+ public interface AfterResponseHook {
20+
21+ void after (Request request , Response response );
22+ }
You can’t perform that action at this time.
0 commit comments