Package dev.relism.flash.extension
Class FlashRegistrar<SELF extends FlashRegistrar<SELF>>
java.lang.Object
dev.relism.flash.extension.FlashRegistrar<SELF>
- Type Parameters:
SELF- concrete registrar type — enables fluent chaining without casting
- Direct Known Subclasses:
FlashApp,FlashScope
Common route-registration surface shared by
FlashApp and FlashScope.
All route methods register immediately — no deferred .with() call.
Middleware is passed as a varargs third argument:
app.get("/ping", (req, res) -> "pong")
app.get("/secured", (req, res) -> user(), oidc.protect())
app.get("/admin", handler, oidc.requireRole("admin"), rateLimiter)
FlashExtension.routes(dev.relism.flash.extension.FlashRegistrar<?>, dev.relism.flash.extension.FlashContext) receives a FlashRegistrar<?> for route
registration. Extension installation (install()) is only available on
FlashApp — scoped install is intentionally unsupported.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract voidRegisters a middleware in this registrar's own scope (global or scope-level).protected abstract voidaddRoute(HttpMethod method, String path, RequestHandler handler, List<Middleware> mw) Adds a route immediately to this registrar's deferred compilation list.protected abstract voidaddWsRoute(String path, WebSocketEndpoint endpoint) final SELFconnect(String path, SimpleHandler.FunctionalHandler h, Middleware... mw) abstract FlashContextctx()Returns theFlashContextfor this registrar.final SELFdelete(String path, SimpleHandler.FunctionalHandler h, Middleware... mw) final SELFget(String path, SimpleHandler.FunctionalHandler h, Middleware... mw) final SELFhead(String path, SimpleHandler.FunctionalHandler h, Middleware... mw) protected static RequestHandlerinstantiate(Class<?> cls) protected static WebSocketEndpointinstantiateWs(Class<?> cls) final SELFoptions(String path, SimpleHandler.FunctionalHandler h, Middleware... mw) final SELFpatch(String path, SimpleHandler.FunctionalHandler h, Middleware... mw) final SELFpost(String path, SimpleHandler.FunctionalHandler h, Middleware... mw) final SELFpurge(String path, SimpleHandler.FunctionalHandler h, Middleware... mw) final SELFput(String path, SimpleHandler.FunctionalHandler h, Middleware... mw) final SELFScanspackageNameforRequestHandlersubclasses with a routing annotation (@Routeor@GET,@POST, …).final SELFtrace(String path, SimpleHandler.FunctionalHandler h, Middleware... mw) final SELFuse(Middleware... middlewares) Adds middlewares to this registrar's own scope.
-
Constructor Details
-
FlashRegistrar
public FlashRegistrar()
-
-
Method Details
-
get
-
post
-
put
-
delete
-
patch
-
options
-
head
-
trace
-
connect
-
purge
-
use
Adds middlewares to this registrar's own scope. OnFlashApp: applied to every route on the app. OnFlashScope: applied to every route in this scope only. Order-independent: middleware is resolved atFlashApp.start(). -
scan
ScanspackageNameforRequestHandlersubclasses with a routing annotation (@Routeor@GET,@POST, …). Each match is constructed with its public no-arg constructor and registered immediately.- Throws:
InitializationException- if the package is empty, not found, or any handler class fails to load or instantiate
-
ctx
Returns theFlashContextfor this registrar. -
addRoute
protected abstract void addRoute(HttpMethod method, String path, RequestHandler handler, List<Middleware> mw) Adds a route immediately to this registrar's deferred compilation list. Subclasses may prepend a namespace prefix and inject scope middlewares before storing. -
addWsRoute
-
addMiddleware
Registers a middleware in this registrar's own scope (global or scope-level). -
instantiate
-
instantiateWs
-