Last updated at 5:25 pm UTC on 10 July 2018
No Files. No HTML. Just Smalltalk code!
HttpView2, also known as HV2 is a lightweight web framework, suitable for building RESTful web applications.
It is the engine that powers SqueakMap.
HV2 was created by Goran Krampe, and was developed by Goran Krampe and Giovanni Corriga.
URL-based component activation:
- Each URL identifies a chain of HV2 objects connected in a parent-child relationship.
- Each object in the chain may dynamically modify the dispatch of HTTP requests and the corresponding responses.
How does this work?
Each part of the URL corresponds to a message understood by an HV2 object.
These methods implement the dispatch and response logic of your application.
For example, let's say
- that the url http://localhost/users/ is requested to your application.
- HV2 will translate this request as a message #users to be sent to the root HV2 object of your application.
- #users will return an object that can be converted into an HTTP response.
No templates used!
Instead of templates HV2 uses a builder system.
Automatic form handling: no need to name your forms and the fields within them: HV2 will take care of that. The values of a submitted form may be easily retrieved simply by sending a #value message to right objects. This makes form creation as easy as building GUIs!
Small codebase: the whole framework is just a handful of classes.
From SqueakMap install in order
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.
HV2 and Seaside
HV2 exploits the HTTP request/response model that Seaside abstracts away. This makes HV2 well suited for RESTful, asynchronous web applications that don't require an high degree of interactivity, while Seaside is ideal for complex, interactive web applications.
More: HttpView2 versus Seaside
HttpView2 may be downloaded from SqueakMap
- Add Cees de Groot's patches to integrate Seaside and HV2
- Better support for HTTP put and delete operations
WebServer (= the web server now in trunk, not directly related to KomHttpServer on which HttpView2 is based).
Teapot micro web framework (Pharo, probably based on a modified version of WebServer)
Building and Deploying a Small Web application (Pharo)