Any idea why this code fails?
package require Site
package require Nub
## Initialise Site...
Site init home $DocumentRoot config $SiteConfiguration
Nub domain /system/ Direct object test
Site start
invalid command name "Nub"
while executing
"Nub domain /system/ Direct object test"
(file "server.tcl" line 31)
Regards,
George
::Nub doesn't come into existence until the server starts. You can put
things like this into the local.tcl script, or another script whose name
is parameterised by the 'local' site var, but otherwise it's not available.
Recommend calling Site.tcl to start the server, and putting the nubs
into site.config, as follows:
/system/ {
domain Direct
object test
}
If you want the startup to 'new' an instance of class Test for you, then:
/system/ {
domain Direct
object Test param val param val ...
}
If you want it to 'create' an instance of class Test for you, then:
/system/ {
domain Direct
object Test ::test param val param val ...
}
Colin.
I know about the static configuration in site.config, but I was hoping
for something more dynamic than that. Like creating nubs on the fly. I
think this functionality was available in Wub in the past. It has been
dropped?
I want to expose an HTTP REST API for an application. The nubs that must
be exposed are the "systems" and "collections" of that application, that
can be dynamically created.
What are my alternatives in supporting this?
Regards,
George
It has not been dropped, it just can't appear there. Put it in
local.tcl and it should work just fine.
> I want to expose an HTTP REST API for an application. The nubs that
> must be exposed are the "systems" and "collections" of that
> application, that can be dynamically created.
> What are my alternatives in supporting this?
I would use Direct domain for anything that looks like a bunch of
commands. Have a look in the Direct.tcl file - there's quite a bit of
documentation there on how it works.
Colin.
Regards,
George