[Seaside] Tons of rest ful url

Lukas Renggli renggli at gmail.com
Tue Feb 17 16:13:11 UTC 2009


> Is it possible to generate thousand of restful url from a seaside
> applicaton? (more like a catalog)

Sure, in your root component you implement something along:

YourRootComponent>>initialRequest: aRequest
     | catalogId catalogItem |
     super initialRequest: aRequest.
     catalogId := aRequest url path last.
     catalogItem := self lookupInCatalog: catalogId.
     catelogItem isNil
          ifFalse: [ self show: (YourCatalogItemViewer on: catelogItem) ]

catalogId gets the last element of the request path assigned.

catalogItem and the method #lookupInCatalog: maps the above string to
an object. To get a restful application this method should always
return the same object for the same catalogId, otherwise your
application won't be restful.

> If so at which cost?

In the above example almost for free. You just have to maintain the
mapping from catalogId to your catalogItems. You can store millions of
such mappings in an external database, thousands within your image.

In fact you can create a truly infinite number of restful entry points
into an application at no cost if you create a smart implementation of
#lookupInCatalog: ;-)

> and is it reliable in the long term?

That's very reliable. Have a look at the google search results of my
website (http://www.google.com/search?q=site:lukas-renggli.ch). The
search result all identify uniquely objects through the restful URL
that live within an image on the server already for years.

Lukas

-- 
Lukas Renggli
http://www.lukas-renggli.ch


More information about the seaside mailing list