i spent the last year just spinning

This commit is contained in:
Relism
2026-04-17 18:56:06 +02:00
parent 9efbe38c0c
commit e161497f2c
77 changed files with 2545 additions and 877 deletions
@@ -0,0 +1,31 @@
# Model and Globals
`ViewModel` is the per-request model builder.
## Merge Order
Runtime merge order is:
1. all extension globals under reserved `global` namespace
2. local handler model
Handlers cannot set top-level `global`; runtime throws fail-fast to prevent namespace collisions.
## Globals
Register globals on extension setup:
```java
new ViewExtension(ViewEngineType.THYMELEAF)
.addGlobal("appName", req -> "Flash")
.addGlobal("path", req -> req.path());
```
Template usage:
```html
<span th:text="${global.appName}"></span>
<span th:text="${global.path}"></span>
```
Keep globals cheap: no blocking I/O or heavy allocations.