classafBedSheet::BedSheetBuilder
sys::Obj afBedSheet::BedSheetBuilder
Use to programmatically create and launch BedSheet server instances.
watchdog := true BedSheetBuilder(AppModule#).startWisp(8069, watchdog, "dev")
Note that BedSheet requires specific IoC config to run. Hence when running BedSheet apps this class should be used in preference to afIoc::RegistryBuilder
.
The toRegistryBuilder() method can be used to build a web app, but not start the web app or listen to a port.
Note the following options:
Name | Type | Value |
---|---|---|
wisp.sessionStore | Type | The |
wisp.sessionStoreProxy | Type | The |
- addModule
This addModule(Type moduleType)
Adds an IoC module to the registry.
- addModules
This addModules(Type[] modules)
Adds many IoC modules to the registry.
- addModulesFromPod
This addModulesFromPod(Str podName, Bool addDependencies := true)
Inspects the pod's meta-data for the key
afIoc.module
. This is then treated as a CSV list of (qualified) module type names to load.If
addDependencies
istrue
then the pod's dependencies are also inspected for IoC modules.Convenience for
registryBuilder.addModulesFromPod()
- appName
Str appName()
The application name. Returns
pod.dis
(orproj.name
if not found) from the application's pod meta, or the pod name if neither are defined. Read only.- build
Registry build()
Builds the IoC
Registry
.Essentially a convenience method for
toRegistryBuilder.build()
.- enableRequestLogs
This enableRequestLogs()
Enables request logs being setting BedSheet's logging level to debug.
- makeFromAppModule
new makeFromAppModule(Type appModule)
Creates a
BedSheetBuilder
from the givenAppModule
.- makeFromName
new makeFromName(Str modOrPodName, Bool addPodDependencies := true)
Creates a
BedSheetBuilder
.modOrPodName
may be a pod name or a qualifiedAppModule
type name.addPodDependencies
is only used if a pod name is passed in.- options
Str:Obj? options := ... { private set }
Options for IoC
RegistryBuilder
. Map is mutable, but this field read only.- port
Int port
The HTTP port to run the app on. Defaults to
8069
- removeModule
This removeModule(Type moduleType)
Removes modules of the given type. If a module of the given type is subsequently added, it is silently ignored.
- setIpAddress
This setIpAddress(IpAddr? ipAddr)
Sets the local IP address that Wisp should bind to, or set to
null
for the default.This is useful when deploying your application to Open Shift or similar where the local IP address is mandated. See the Fantom Forum topic: IP address for afBedSheet.
- setOption
This setOption(Str name, Obj? value)
Sets a value in the
options
map. Returnsthis
so it may be used as a builder method.- silence
This silence()
Suppresses surplus logging by this and IoC's
RegistryBuilder
.- startWisp
Int startWisp(Int port := 8069, Bool watchdog := false, Str? env := null)
Convenience method to start a Wisp server running
BedSheetWebMod
.- toRegistryBuilder
RegistryBuilder toRegistryBuilder()
Copies the content of this builder, including all the BedSheet specific config, into an IoC
RegistryBuilder
instance.