Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions pages/docs/docs-future-7.md
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,23 @@ config.routes.afterMatched { ctx ->
{% endcapture %}
{% include macros/docsSnippet.html java=java kotlin=kotlin %}

### Wrapper handlers
Wrapper-handlers run "around" requests.

This is useful when you need to "wrap", for example to propagate a `ThreadLocal` or a `ScopedValue`:

{% capture java %}
config.router.handlerWrapper(endpoint -> ctx -> ScopedValue.where(...).run(endpoint.handle(ctx)));
{% endcapture %}
{% capture kotlin %}
config.router.handlerWrapper {
ScopedValue.where(...).run(endpoint.handle(ctx))
}
{% endcapture %}
{% include macros/docsSnippet.html java=java kotlin=kotlin %}

Note that `handlerWrapper` is on `router` not on `routes` of `config`.

### Context
The `Context` object provides you with everything you need to handle a http-request.
It contains the underlying servlet-request and servlet-response, and a bunch of getters
Expand Down