HTTP request handler.
| 6 | * HTTP request handler. |
| 7 | */ |
| 8 | public interface Handler { |
| 9 | |
| 10 | /** |
| 11 | * Handle HTTP request. |
| 12 | * This method is called on the event loop thread. It must be non-blocking! |
| 13 | * The callee must invoke the callback once and only once. |
| 14 | * The callback may either be invoked synchronously before handle terminates or |
| 15 | * asynchronously in a background thread. |
| 16 | * The provided callback object has a reference to internal connection state. |
| 17 | * Avoid retaining the callback for an extended period. |
| 18 | */ |
| 19 | void handle(Request request, Consumer<Response> callback); |
| 20 | |
| 21 | } |