Multiple entry point best practices

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Multiple entry point best practices

cnantais
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
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

RE: Multiple entry point best practices

Ramon Leon-5
> 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.

Host your app in Pier, it has bookmarkable urls.

_______________________________________________
Seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Multiple entry point best practices

Zulq Alam-2
In reply to this post by cnantais
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
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Re: Multiple entry point best practices

cnantais
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 <[hidden email]> 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
> [hidden email]
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>
_______________________________________________
Seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside