Skip to content

Commit 613ba9c

Browse files
authored
Create README.md
1 parent 576cdd3 commit 613ba9c

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

  • stubbornjava-undertow/src/main/java/com/stubbornjava/undertow/handlers
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Custom Undertow HttpHandlers
2+
3+
## Middleware (Filters / interceptors)
4+
The MiddlewareBuilder is a helper for composing HttpHandlers. Many existing and custom HttpHandlers are passed one or more delegate handlers and route accordingly based on some logic. Maintaining deeply nested handlers can sometimes be a challenge. [Middlware](https://www.stubbornjava.com/posts/logging-gzip-blocking-exception-handling-metrics-middleware-chaining-in-undertow) is here to help.
5+
```
6+
MiddlewareBuilder.begin(BlockingHandler::new)
7+
.next(CustomHandlers::gzip)
8+
.next(CustomHandlers::accessLog)
9+
.next(CustomHandlers::statusCodeMetrics)
10+
.next(MiddlewareServer::exceptionHandler)
11+
.complete(handler);
12+
```
13+

0 commit comments

Comments
 (0)