Swazoo runs on GST!
By Paolo Bonzini - Posted on February 6th, 2008
Tagged:
That's it! Swazoo runs on GNU Smalltalk! Code is not yet committed, but it works and passes the entire testsuite.
This script for example will start a web server on http://localhost:8888/
PackageLoader fileInPackage: 'Swazoo'.
Swazoo.Resource subclass: MyResource [
answerTo: aRequest [
| response |
response := Swazoo.HTTPResponse ok.
response entity: '<h1>Hello World!</h1>'.
^response
]
]
site := Swazoo.Site new name: 'test'. "name is just for convenience"
site host: 'localhost' ip: '127.0.0.1' port: 8888.
resource := MyResource new uriPattern: 'helloworld.html'.
composite := Swazoo.CompositeResource new uriPattern: '/'.
composite addResource: resource.
site addResource: composite.
Swazoo.SwazooServer singleton addSite: site.
site start.
Processor activeProcess suspend
The port took me about an hour, and the good news is that it also involved fixing bugs in GNU Smalltalk rather than dealing with dialect incompatibilites. I found a couple of dialect problems and I hope Janko will fix them soon.
I would like to make a "GST remote-control" that uses a socket to command a daemon running the VM. For example the above could be written as:
gst-remote --port 12345 --daemon gst-remote --port 12345 --file MyResource.st gst-remote --port 12345 --site site.cnf gst-remote --port 12345 --start test ... gst-remote --port 12345 --stop test gst-remote --port 12345 --drop test gst-remote --port 12345 --kill
where site.cnf is
<Site name: 'test'; host: 'localhost' ip: '127.0.0.1' port: 8888> <CompositeResource uriPattern: '/'> <MyResource uriPattern: 'helloworld.html'> </CompositeResource> </Site>
or even:
gst-remote --port=12345 --daemon --file MyResource.st --site site.cnf --start test ... gst-remote --port 12345 --stop test --drop test --kill
Paolo

Getting more things to run on GST is great.
Good job Paolo!
Is this Swazoo 1 or Swazoo 2?
This is latest Swazoo 2.1
Janko