BedSheet DraftUser Guide
Overview
BedSheetDraft
is a library for integrating draft components with the BedSheet web framework.
With BedSheetDraft
you can:
- Use draft Routes
- Use draft Flash
Draft Routing
Draft Routes match request URIs and calls request handlers with a single map of arguments. Contribute draft routes to the DraftRoutes service:
using afIoc using afBedSheetDraft using draft::Route as DraftRoute class AppModule { ... @Contribute { serviceType=DraftRoutes# } static Void contributeRoutes(Configuration conf) { conf.add(DraftRoute("/", "GET", PageHandler#index)) conf.add(DraftRoute("/echo/{name}/{age}", "GET", PageHandler#print)) } }
Draft Flash
Draft Flash is contributed as a threaded service and may be accessed as such:
@Inject private Flash flash
Note that Flash
is not a const
class so it may not be injected into const
services. Instead create a flash method that accesses the IoC registry:
using afIoc using draft::Flash as DraftFlash class ThreadedHandler { @Inject private Registry registry new make(|This|in) { in(this) } DraftFlash flash() { registry.dependencyByType(DraftFlash#) } }
Or you can inject a Lazy Func which performs the same job:
using afIoc using draft::Flash as DraftFlash class ThreadedHandler { @Inject private |->DraftFlash| flash new make(|This|in) { in(this) } }