[Seaside] Static content idea

Avi Bryant avi at beta4.com
Mon Sep 1 13:25:00 CEST 2003


On Mon, 1 Sep 2003, Markus Fritsche wrote:

> Hi!
>
> I'm evaluating if I could use seaside for my little weblog project (the
> time of chat-software as an exercise is over). However, I'd definetly
> need some sort of these "permanent links" seen in the weblog world.
>
> I had the following idea, not sure if it works: Every entry presents a
> link with uuid as get-parameter. When the application is called and the
> session couldn't be found, a "page not found" exception is raised, or a
> method "sessionTimeOut: getParameters" will be sent, giving my
> component the chance to intialize and react properly - is this
> possible?

This pretty much already happens.  You can see the Wiki example, or
Gardner, as an example.  There are two steps needed:

- When you are on the page that you want to have a permanent link (ie,
when the user clicks your "permalink"), send #addToPath: to the current
session with some unique identifier.  In the wiki example, this looks
basically like "self session addToPath: self pageName".

This will insert an extra segment with that identifier into the URL.  As
long as the URL has a valid session id and action key, this segment will
be completely ignored.  However, once the session times out, you'll get a
chance to do something with it:

- in your Session subclass, override #createRootFromRequest:.  This takes
a WARequest as a parameter and is expected to return a component instance.
It's called when a session is just starting, and normally returns an
instance of the defined entry point.  However, you are free to examine the
request, extract your ID from the URL, and create some other component
based on that.

Now I have to admit that this doesn't *quite* meet the needs of a weblog.
It was designed so that bookmarking the current page would work, but
right-clicking on the "permalink" and saving its URL wouldn't work - the
URL won't have the extra ID in it until you actually follow it (and go
through the associated redirect).  So you'll probably need to write a
special version of #anchorWithAction:text:  that adds the extra segment in
at that level.  If you need help with that, let me know.

Avi




More information about the Seaside mailing list