








HttpView2
HttpView2 is a lightweight web framework based on KomHttpServer. I use it for a few different applications (like SqueakMap for example) but I haven't bothered to "polish" it much. I just let it evolve from the needs of my projects! :)
HttpView differs a bit from "classic" such frameworks:
- Url resolution: The url "path" strictly corresponds to a chain of HttpView instances connected together with a parent pointer. The "document" name at the end of the url is matched with a message selector in the HttpView instance.
- Page construction: Pages and HTML components are built by "feeding" a builder object - an instance of HVHtmlBuilder - messages from a rather large protocol. The builder has plenty of "smart" messages that makes building pages and Forms a breeze. And it's all in Smalltalk.
- Forms handling: The Forms are constructed from instances of classes like HVHtmlForm, HVHtmlInputCheckbox, HVHtmlSelect etc. This means that Forms are built much like you build UIs in Morphic or Java's Swing. When a Form is submitted the values of the fields are easily accessible by sending the message #value to it!
Noteworthy things:
- All Smalltalk. No HTML. No files. Just code.
- Very simple to build forms.
- Very easy to customize for your own needs. Very small codebase.
Getting started with HttpView2 in Squeak 3.7
The following step-by-step was performed using Squeak3.7-5989-basic in a Linux box.
- Download and fire up Squeak 3.7, save under a new image name using "save as...".
- Open package loader (left click on desktop, choose "open..."->"SqueakMap Package Loader").
- Select "upgrade all installed packages" (right click in package list to get menu). This should upgrade a few things, answer yes about installing Monticello.
- Install in order: DynamicBindings, KomServices, KomHttpServer, HTMLBuilder and HttpView2.
- Save the image. :)
Now, fire up HelloWorld - read class comment of HVHelloWorld. All samples can be started/stopped on port 8080 by simple sending "startDebug" or "stop" to the class. You can also stop any running sample by sending "stopAll" to any sample class.
Good luck!
/Göran
Development
HttpView is free software (licensed under Squeak-L or MIT). Development is done sofar mainly by me, but if you have anything, just email me or post on the squeak-dev mailinglist which I follow.