[Seaside] Re: Multiple entry point best practices

Chad Nantais cnantais at gmail.com
Tue Sep 19 19:22:36 UTC 2006


Thanks Zulq.

I used your tip and created a special mapping class to define url
mappings to components.  Seems to work okay so far.

Cheers,

Chad

On 9/18/06, Zulq Alam <me at zulq.net> wrote:
> Hi Chad,
>
> You can send #url to a WARequiest to get the path, e.g.
> '/seaside/myapp/photos/243'. After which you can use String>>findTokens.
>
> MYRenderLoopMain>>start:aRequest
>    | urlParts |
>    urlParts := aRequest url findTokens: '/'.
>    ^urlParts size = 4 ifTrue:
>        [urlParts at: 3 = 'photos'
>          ifTrue: [self answer: aRequest withPhoto: (urlParts at: 4)].
>        urlParts at: 3 = 'places'
>          ifTrue: [self answer: aRequest withPlace: (urlParts at: 4)].
>      ifFalse: [super start: aRequest].
>
> Not exactly elegant and possibly not what you should do, just showing
> you how to get the 'photos' bit.
>
> Thanks,
> Zulq.
>
> Chad Nantais wrote:
> > I'm building an application that will have different entry points.  It
> > will be structured like this:
> >
> > main (MYMainComponent)
> > -users (MYUserComponent)
> > -photos (MYPhotoComponent)
> > -places (MYPlaceComponent)
> >
> > This will allow users to bookmark, say, a photo with a url like
> > '/seaside/myapp/photos/243'.
> >
> > I need all four to share the same application header, footer, and
> > session so that it's one continuous application.
> >
> > I seem to have two options:
> > 1. Create subdirectory entry points for each
> > 2. Override WARenderLoopMain>>start: and create rules to dispatch
> > requests to the right component.
> >
> > What's the smartest way to do this?
> >
> > In the case of #2, I don't know how to extract the component subdir
> > from the url (eg: 'photos' in /seaside/myapp/photos/243).  I only know
> > how to get field values (eg: id=243).
> >
> > Thanks in advance for any tips.
> >
> > Chad
>
> _______________________________________________
> Seaside mailing list
> Seaside at lists.squeakfoundation.org
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>


More information about the Seaside mailing list