Lots of languages have microframeworks for writing very tiny websites or web services, such as Flask for Python, or Sinatra for Ruby. On Squeak, there doesn't seem to be any equivalent; Iliad, Seaside, and AIDA are all very heavy for just having a little service. What's the preferred way to accomplish this? Directly injecting a hanlder into Comanche or Swazoo?
相关问题
- Is the Namespace for a SOAP Web Service case sensi
- How can I send parameters for ASP.NET webservice
- Http post request to a Django webservice (need log
- Sending Data to server using Jsoup Android
- Simple class definition error in smalltalk
相关文章
- Using JAX-WS 2.2.5 client with JDK/JRE 1.5
- Cannot use org.jvnet.jax-ws-commons.jaxws-maven-pl
- How to create base64Binary data?
- Are there any public UDDI registries available?
- REST search interface and the idempotency of GET
- Implementation Strategies for Object Orientation
- Add Service Reference and Add Web Reference?
- What is the difference between Seaside programmmin
You can subclass a SwazooSite in Swazoo for such a micro website, but I think you will soon end needing more functionality, so starting directly on one of those three frameworks are better bet long-term.
That they are heavy is maybe just an impression and lack of better documentation of usage for such simple websites. Also, if you look at the framework as blackbox, which is complex internally but simple externally, then I'd say all Smalltalk web frameworks are quite simple comparing to other web frameworks.
I would like to share what I think is more up-to-date information (as of end of 2012).
Zinc Components
Currently in Pharo 1.4/2.0 the de-facto standard for HTTP client/server seems to be the Zinc HTTP Components. And the latest Seaside version (3.0) switched to Zinc as well.
You can of course use Zinc directly to implement web-services or serve web-pages.
Take a look particularly at classes
ZnServer
and search for classes likeZn*Delegate
(likeZnDefaultServerDelegate
orZnStaticFileServerDelegate
)Seaside REST
Latest versions of Seaside include support for RESTful web-services. This can be used to implement web-services or serve web-pages. It's pretty straightforward.
For more information look at the "REST Services" chapter of the online Seaside book. This chapter centers about implementing web-services, but it works for web-pages as well.
Ratpack
I have also been told about Ratpack, a sinatra-like web-framework developed by Tim Felgentreff. There are two repositories. I think the github one is more recent. See here:
This information comes from a similar question I posted recently.
For really simple cases, you can just register with (or subclass) Kom's HttpService like so (from the class comment, see for more info/options):
You can also use teapot. Teapot is micro web framework on top of the Zinc HTTP components, that focuses on simplicity and ease of use. It's under 500 lines of code, not counting the tests.
There are available mustache templates, output transformers, before filters. The framework is well documented.