[aida] domain to App mapping

nicolas petton petton.nicolas at gmail.com
Fri Oct 26 17:19:51 CEST 2007


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].
	^webApp


AIDASite>>mappings
	^self settings at: #mappings ifAbsentPut: [Dictionary new]. 


AIDASite>>mapApp: aWebApplication for: anObject
	self mappings at: anObject put: aWebApplication 


Then in my AIDASite subclass:

admin
	^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].



Cheers,

Nicolas
> 
> Janko
> _______________________________________________
> Aida mailing list
> Aida at aidaweb.si
> http://lists.aidaweb.si/mailman/listinfo/aida
-- 
Nicolas Petton
http://nico.bioskop.fr
             ___
           ooooooo
          OOOOOOOOO
         |Smalltalk|
          OOOOOOOOO
           ooooooo
            \   /
             [|]
--------------------------------
Ma clé GPG est disponible ici :
http://pgp.mit.edu:11371/pks/lookup?op=get&search=0xE788C34D

-------------- section suivante --------------
Une pi�ce jointe non texte a �t� nettoy�e...
Nom: non disponible
Type: application/pgp-signature
Taille: 189 octets
Desc: Ceci est une partie de message
	=?ISO-8859-1?Q?num=E9riquement?= =?ISO-8859-1?Q?_sign=E9e?=
Url: http://lists.aidaweb.si/pipermail/aida/attachments/20071026/0bc96cdc/attachment.sig 


More information about the Aida mailing list