« Return to Thread: preferredUrl usage

Re: preferedUrl usage

by Janko Mivsek :: Rate this Message:

Reply to Author | View in Thread

Leon,

Always remember that in Aida Urls point to domain objects and never to
Apps (web representaions of domain objects). Also, preferedUrl method
must be implemented on domain object, not App!

So, first, put preferedUrl in Contest, not ContestApp. Also, viewMain
must be in ContestSiteApp, not ContestSite.

Therefore you'll have:

   UwaliContestSite
     UwaliContest

and

   UwaliContestSiteApp (subclass of WebApplication)
   UwaliContestApp (subclass of WebApplication)

Remember that App class must be exactly a combination of domain class +
'App'. In your example UwaliContest > UwaliContestApp .

Do you have your classes as shown above?

Janko



Leon Smith wrote:

> Thanks Janko and Giuseppe for your responses. Janko's response explained the
> caching behavior thats been driving me mad. Now I have another problem. I
> stopped my site, removed it, re-created it, stopped the SwazooServer, and
> evaluated this in a workspace:
>
> | site  |
>
> site := UwaliContestSite demo.
> (AIDASite named: 'uwali') urlResolver defaultURL: '/uwali.html' forObject:
> site .
> (AIDASite named: 'uwali')
>         urlResolver changeToPreferedURL: site.
> site contests do:[ :aContest |
> (AIDASite named: 'uwali')
>         urlResolver changeToPreferedURL: aContest].
>
>
> The demo method creates some dummy contest objects, adds them to the
> contestSite and persists the site as the root object to a GOODS database,
>
> The preferedURL method is on the instance side of ContestApp and looks like
> this:
>
> preferedUrl
> | aTitle |
> aTitle := self title trimBlanks.
> aTitle := aTitle copyReplaceAll: ' ' with: '-'.
> ^'/uwali/', aTitle, '.html'.
>
> The view method of ContestSite looks like this:
>
> viewMain
>         | e |
>         e := WebElement new.
>         e addTextH1: 'Uwali Contest Site'.
> e table class: #webGrid.
>        self observee contests do: [:each |
>             e cell addText: each title.
> e newCell addText: each categoryTitle.
>             e newCell addText: ', ', each shortDescription.
> e newCell addLinkTo: each  text: each title.
>             e newRow].
>         self pageFrameWith: e title: 'Contest Site'
>
> Now the link looks good (eg. /uwali/dummy-contest-one.html ), but when I
> click on it, I get an error message that says "Cannot find aWebApplication
> for object aContest". I'm sure that the problem is with my addLinkTo: syntax
> above, but I'm not sure how to fix it.
>
> Thanks
>
> Leon

--
Janko Mivšek
AIDA/Web
Smalltalk Web Application Server
http://www.aidaweb.si
_______________________________________________
Aida mailing list
Aida@...
http://lists.aidaweb.si/mailman/listinfo/aida

 « Return to Thread: preferredUrl usage

LightInTheBox - Buy quality products at wholesale price