[Seaside] Re: Tons of rest ful url
hilaire at ofset.org
Wed Feb 18 07:53:25 UTC 2009
Ok, thanks for the tips.
Now I want to see if it is possible to get a little more ;)
Let's suppose my top level component is the view of an object A and I
want to build a meaningful and restful url based on A attributes like
The idea is the get url like /nomenclature/discipline-2007.html
Is it possible?
Le mardi 17 février 2009 à 17:13 +0100, Lukas Renggli a écrit :
> > 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.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Size: 189 bytes
Desc: Ceci est une partie de message
Url : http://lists.squeakfoundation.org/pipermail/seaside/attachments/20090218/664d35b4/attachment-0001.pgp
More information about the seaside