[Seaside] Emission of static web pages?
Nevin Pratt
nevin at bountifulbaby.com
Wed Jun 8 17:13:54 CEST 2005
Greg Lewin wrote:
> Hi,
>
> I've played with Seaside a bit and like the look of it, and have been
> keen on Smalltalk for a long time, which adds extra interest.
>
> I've looked at the documentation and don't see any obvious answers to
> this:
>
> While Seaside is clearly great for dynamic pages, and as a development
> environment, I've been wondering how easy it is to emit a static set
> of completely self-sufficient, stand-alone web pages which can be
> propagated to another web server. If it is easy, this would make it
> even more useful to more people - e.g. those who don't want to use
> Squeak as a web server ( i.e. commercial hosts).
>
> I apologise if the answer is yes and it's obvious, but I haven't seen
> it yet.
>
> Thanks for a very nice product.
>
> Greg
There are many ways to do this, but be careful not to confuse what
Seaside does vs. what, say, Apache or Comanche does. Seaside requires a
web server like Apache or Comanche-- you cannot have Seaside without one
of them (or something similar to them, like Swazoo or something). And,
Apache/Comanche/whatever are perfectly capable of serving a "static set
of completely self-sufficent, stand-alone web pages" all by themselves.
Thus, since Seaside requires such a web server, then a system employing
Seaside will also automatically be capable of serving a "static set of
completely self-sufficient, stand-alone web pages", as a side-effect.
Bountiful Baby has a large mix of static and Seaside-generated dynamic
pages. Bountiful Baby actually consists of two domains: (1)
bountifulbaby.com, and (2) bountifulbaby.net. The bountifulbaby.net
domain is serviced by Apache, and just serves up static content. The
bountifulbaby.com domain is serviced by Squeak/Seaside/Comanche, and is
*primarily* dynamic Seaside pages. Thus, we can easily include a
redirect from any dynamic page to a static page, just by referencing
".net" instead of ".com" in the redirect.
To see an example of this particular technique, go to bountifulbaby.com
and look at the pictures. Check where they are located, and you will
see they are all on the ".net" domain. That's just one example of
bountifulbaby.com doing this.
The bountifulbaby.com domain also serves up some static content of its
own, via two different mechanisms, either one of which works just fine
for static content. A Seaside URL will include the string "seaside" in
the URL. Within Comanche, it is trivial to just look for "seaside" in
the incoming URL, and if it is not present, do not dispatch to Seaside,
but instead handle it the usual Comanche way. Thus...voila! Static
pages. And, Apache can do the exact same thing.
I used to use the above technique for a number things, but currently I
only use the above technique for virtual hosting. That is, if the
incoming URL does *not* include the string "bountifulbaby". For
example, http://www.smalltalkpro.com is a domain hosted by the same
Squeak/Seaside/Comanche image that is hosting bountifulbaby.com.
You can also have Seaside serve static pages for any given URL prefix,
even if it includes "seaside" in the URL, simply by caching the
generated Seaside pages in a class variable, and feeding the cached
version back anytime that same URL prefix is encountered. I use that
technique for all detected spiders. To see it, first request the
"robots.txt" page (so that the website thinks you are a spider), and
then hit the site, or hit any internal page (including the main page, if
you choose), thus:
http://www.bountifulbaby.com/robots.txt
http://www.bountifulbaby.com/seaside/index/aboutus
Now, since the site thinks you are a spider, click any link or button,
and *all* you will get back are static pages. You won't get back any
dynamically generated pages *at all*.
The spider detection mechanism uses many techniques to detect spiders--
the request of a "robots.txt" page is just one of them (under the
assumption that nobody but a spider would be interested in that page).
And, after an hour or so of no access, the site will "forget" you are a
spider, and reset you.
Bountiful Baby uses all three methods mentioned above to serve static
content. And, there are yet other ways to do it, too.
Nevin
More information about the Seaside
mailing list