Package dev.relism.flash.ext.view.core
Class BaseViewHandler<TTarget>
java.lang.Object
dev.relism.flash.models.RequestHandler
dev.relism.flash.ext.view.core.BaseViewHandler<TTarget>
- Direct Known Subclasses:
JteHandler,ThymeleafHandler
-
Constructor Summary
Constructors -
Method Summary
Methods inherited from class dev.relism.flash.models.RequestHandler
bind, find, optional, require
-
Constructor Details
-
BaseViewHandler
public BaseViewHandler()
-
-
Method Details
-
render
- Throws:
Exception
-
render
- Throws:
Exception
-
onInit
protected final void onInit()Description copied from class:RequestHandlerOverride to cache services at boot time. Called once afterRequestHandler.bind(dev.relism.flash.extension.FlashContext), before any request reaches this handler.Use
RequestHandler.require(java.lang.Class<T>)andRequestHandler.find(java.lang.Class<T>)to retrieve services from theFlashContext. Cache them in private fields so the hot-path (RequestHandler.handle(dev.relism.flash.models.Request, dev.relism.flash.models.Response)) has zero lookup overhead.Important: if your class extends another handler base (e.g.
JacksonHandler), callsuper.onInit()first so the parent can initialise its own services.@Override protected void onInit() { super.onInit(); myService = require(MyService.class); }- Overrides:
onInitin classRequestHandler
-
onViewInit
protected void onViewInit() -
handle
Description copied from class:RequestHandlerHandles an incoming request. The return value determines the response body: return aResponseto replace the whole response, any other non-null value to set it as the body, ornullto leave the response as-is.- Specified by:
handlein classRequestHandler- Throws:
Exception
-
renderInternal
- Throws:
Exception
-