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
Install
Install BedSheet Draft
with the Fantom Repository Manager ( fanr ):
C:\> fanr install -r http://repo.status302.com/fanr/ afBedSheetDraft
To use in a Fantom project, add a dependency to build.fan
:
depends = ["sys 1.0", ..., "afBedSheetDraft 1.1+"]
Documentation
Full API & fandocs are available on the Status302 repository.
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#) } }
Release Notes
v1.1.6
- Chg: Updated to use IoC 2.0.0.
v1.1.4
- Chg: Updated to use IoC 1.7.2 and BedSheet 1.3.12.
v1.1.2
- Chg: Updated to use IoC 1.5.2 and BedSheet 1.3.0.
v1.1.0
- Chg: Updated to use BedSheet 1.2.
- Chg:
DraftRoute
objects must now be contributed to the DraftRoutes service, not the BedSheetRoutes
service.
v1.0.4
- Chg: Updated to IoC 1.4.0.
- Chg: Transferred VCS ownership to Alien-Factory
v1.0.2
- Chg: Updated tests to use
BedServer
andBedClient
v1.0.0
- New: Initial release