[Seaside] Re: Multiple entry point best practices
me at zulq.net
Tue Sep 19 00:11:29 UTC 2006
You can send #url to a WARequiest to get the path, e.g.
'/seaside/myapp/photos/243'. After which you can use String>>findTokens.
| 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.
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
> 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.
More information about the Seaside