[aida] domain to App mapping
janko.mivsek at eranova.si
Sun Oct 28 10:46:33 CET 2007
Nicolas perfect! I'll look at your patch and integrate it in mainstream
Aida when I'll return home.
nicolas petton a écrit :
> Le vendredi 26 octobre 2007 à 16:28 +0200, Janko Mivšek a écrit :
>> nicolas petton a écrit :
>>>>> I have another idea, but I don't know how to do. I would like to
>>>>> subclass WebSecurityManagerApp but without subclassing
>>>>> WebSecurityManager. But is there a way to set a custom app to an object
>>>>> (an app with a different name)? Something like:
>>>>> UrlResolver defaultUrl: '/admin.html' forObject: admin app: MyAdminApp
>>>> That's interesting idea and also a problem which needs to be solved
>>>> somehow. To solve most generally I would start with some object to App
>>>> map and add it to AIDASite, maybe in settings. Then I'd just extend
>>>> method Object>>webApp to look in this map too. What do you think?
>>> I think it's a very good idea :) This way it would easier to extend
>>> existing models and apps, without overriding existing methods. If you
>>> want I can do it (at least I can try).
>> Yes, just try it, then we'll finish together. Another place for map can
>> beWebStyle, but that class is already overloaded ...
> I tried it, and it seems to work fine.
> Object>>webAppFor: aSession
> | webApp |
> aSession isNil ifTrue: [^nil].
> webApp := aSession webAppFor: self.
> webApp notNil ifTrue: [^webApp].
> webApp := self firstSessionFromStack site mappings at: self ifAbsent:
> webApp ifNil: [webApp := WebApplication newFor: self on: aSession]
> ifNotNil: [webApp observee: self; session: aSession; postInitialize].
> "I know, it's uggly, but it works !"
> webApp notNil ifTrue: [aSession addWebApp: webApp for: self].
> ^self settings at: #mappings ifAbsentPut: [Dictionary new].
> AIDASite>>mapApp: aWebApplication for: anObject
> self mappings at: anObject put: aWebApplication
> Then in my AIDASite subclass:
> ^self systemServices
> at: #Admin
> ifAbsent: [ |admin|
> admin := WebAdmin new.
> self mapApp: MyWebAdminApp new for: admin.
> self addSystemService: admin named: #Admin.
> self urlResolver defaultURL: '/admin.html' forObject: self admin.
> ^self admin].
More information about the Aida