Swazoo Docs

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Swazoo Docs

Esteban A. Maringolo
Hi,

I'm begginning/continuing a Seaside port in Dolphin, to start I looked
the inner working of the Squeak implementation, which is mainly
developed over other web server.

I was looking in the Swazoo Implementation for Dolphin (which seems to
be very complete, the port and Swazoo itself), in order to port
Seaside to Dolphin over Swazoo.

Are there any documentation or draft which may be useful to read? (about swazoo)

Regards,

--
Esteban A. Maringolo
[hidden email]


Reply | Threaded
Open this post in threaded view
|

Re: Swazoo Docs

Janko Mivšek
Hi Esteban,

First I wish you welcome to a Swazoo team! As one knowledgeable of
Squeak you can probably compare Swazoo with their KomHttp server and
help merge them, but about that next time.

Swazoo documentation is scarse if non existent. But after you grasp a
few concepts, it is easy. Let me start with those concepts:

1. *Site* : Swazoo can serve many sites at once (virtual sites). Class
    Site is therefore a main class to start configuring your server. It
    holds an IP, port and hostname of your site.
2. *SwazooServer singleton* : return one and only one server which holds
    the Sites.
3. *Resource* is an abstract class for all so called web resources. Such
    resource has its url address and can serve with responding to web
    requests. Every resource need to #answerTo: aHTTPRequest with
    aHTTPResponse. Site is a subclass of a Resource. You can subclass it
    with your own implementation. There is also a CompositeResource,
    which can hold many subresources. Site is also aCopmpositeResource
    and therefore you can add your own resources to your site.
4. classes *HTTPRequest*, *HTTPResponse* are obvious ones.

Here are fewest steps possible to make your Swazoo site running. Do them
from workspace:

    |site|
    site := Site new name: 'test'. "name is just for convinience"
    site host: 'localhost' ip: '127.0.0.1' port: 8888.
    SwazooServer singleton addSite: site.
    site start.

Now let we do our own web resource with url '/helloworld.html' to return
a web page with ' Hello Word!' :

1. Make new class MyResource by subclassing Swazoo.Resource,
2. implement (actually override) a method answerTo: aRequest :

    | response |
    response := Swazoo.HTTPResponse ok.
    response entity: '<html><body><h1>Hello World!</h1></body></html>'.
    ^response
       
3. from workspace, make instance of your resource, define its url and
    add it to your site:

    | resource composite |
    resource := MyResource new uriPattern: 'helloworld.html'.
    composite := CompositeResource new uriPattern: '/'.
    composite addResource: resource.
    (SwazooServer singleton siteNamed: 'test') addResource: composite.

4. open http://localhost:8888/helloworld.html .


I hope this small tutorial will help your get acustomized with Swazoo
enough to dig by yourself further.

Best regards
Janko





Esteban A. Maringolo wrote:

> Hi,
>
> I'm begginning/continuing a Seaside port in Dolphin, to start I looked
> the inner working of the Squeak implementation, which is mainly
> developed over other web server.
>
> I was looking in the Swazoo Implementation for Dolphin (which seems to
> be very complete, the port and Swazoo itself), in order to port
> Seaside to Dolphin over Swazoo.
>
> Are there any documentation or draft which may be useful to read? (about swazoo)
>
> Regards,
>
> --
> Esteban A. Maringolo
> [hidden email]
>
>
> -------------------------------------------------------
> This SF.Net email is sponsored by the JBoss Inc.
> Get Certified Today * Register for a JBoss Training Course
> Free Certification Exam for All Training Attendees Through End of 2005
> Visit http://www.jboss.com/services/certification for more information
> _______________________________________________
> Swazoo-devel mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/swazoo-devel
>

--
Janko Miv�ek
Svetovalec za informatiko
EraNova d.o.o.
Ljubljana, Slovenija
www.eranova.si
tel:  01 514 22 55
faks: 01 514 22 56
gsm: 031 674 565


Reply | Threaded
Open this post in threaded view
|

Re: Swazoo Docs

Esteban A. Maringolo
2005/10/24, Janko Mivšek <[hidden email]>:
> Hi Esteban,
>
> First I wish you welcome to a Swazoo team!
> As one knowledgeable of
> Squeak you can probably compare Swazoo
> with their KomHttp server and
> help merge them, but about that next time.

I don't know anything about KomHttp, but for what I've seen I choose Swazoo.
However, I used to administrate an Apache, with mod_perl, and
rewriting rules during a couple of years.

> Swazoo documentation is scarse if non existent.
> But after you grasp a few concepts, it is easy.
> Let me start with those concepts:

> 1. *Site* : Swazoo can serve many sites at once (virtual sites).
> Class
> Site is therefore a main class to start configuring your server. It
>  holds an IP, port and hostname of your site.

Great.

> 2. *SwazooServer singleton* : return one and
> only one server which holds  the Sites.

> 3. *Resource* is an abstract class for all so called web resources. Such
>     resource has its url address and can serve with responding to web
>     requests. Every resource need to #answerTo: aHTTPRequest with
>     aHTTPResponse. Site is a subclass of a Resource. You can subclass it
>     with your own implementation. There is also a CompositeResource,
>     which can hold many subresources. Site is also aCopmpositeResource
>     and therefore you can add your own resources to your site.

Yes, this resource implementation looked very impressive, I'll play
around a bit to see and get a better understanding of how it works.

> 4. classes *HTTPRequest*, *HTTPResponse* are obvious ones.

> Here are fewest steps possible to make your Swazoo site running.
 [STEPS SNIPPED]
> I hope this small tutorial will help your get acustomized with Swazoo
> enough to dig by yourself further.

Yes, it was, thank you.
Besides that, the small intro for Swazoo for Dolphin of Steve Waring
was helpful also. And the CampSmalltalk wiki too.

Perhaps some mapping between Apache terminology and Swazoo one would
be very helpful, considering the wide spread of Apache and it's
derivations (Tomcat, etc...)

Regards,

--
Esteban A. Maringolo
[hidden email]