Package dev.relism.flash.routing
Class AbstractRouter
java.lang.Object
dev.relism.flash.routing.AbstractRouter
- Direct Known Subclasses:
FastPathRouterImpl
Base router contract. Owns error handlers and the compile-time middleware
wrapping logic. The only concrete implementation is
FastPathRouterImpl.
All middleware composition happens once at boot time; the hot-path sees
only a plain RequestHandler call with zero allocation overhead.
Default error handlers
- Dev mode (
-Dflash.env=dev): rich HTML pages with full stack traces. - Prod mode (default): generic JSON — no internal detail leaked to clients.
FlashApp.onNotFound(dev.relism.flash.models.SimpleHandler.FunctionalHandler) /
FlashApp.onException(dev.relism.flash.routing.AbstractRouter.ExceptionHandler).
Registration: use FlashApp — the single
public registration API. doRegister(dev.relism.flash.http.HttpMethod, java.lang.String, dev.relism.flash.models.RequestHandler, dev.relism.flash.routing.Middleware[]) is an infrastructure method.
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected AbstractRouter.ExceptionHandlerprotected SimpleHandler -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract AbstractRouteraddRoute(HttpMethod method, String path, RequestHandler handler) doRegister(HttpMethod method, String path, RequestHandler handler, Middleware[] middlewares) Registers a handler with a pre-built middleware array.voidvoidabstract RequestHandlerprotected static voidsetPathParams(Request request, String[] names, dev.relism.fpr.core.ByteView source, int[] starts, int[] lens)
-
Field Details
-
notFoundHandler
-
exceptionHandler
-
-
Constructor Details
-
AbstractRouter
public AbstractRouter()
-
-
Method Details
-
getNotFoundHandler
-
getExceptionHandler
-
onNotFound
-
onException
-
doRegister
public AbstractRouter doRegister(HttpMethod method, String path, RequestHandler handler, Middleware[] middlewares) Registers a handler with a pre-built middleware array. Compiles the middleware chain once at boot — zero overhead on hot-path. -
route
-
addRoute
-
setPathParams
-