notifying all the visible components before and after a request is received

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

notifying all the visible components before and after a request is received

Martin Rubi
Hi.
I'd like to notify all of the visible presenters before and after a request is handled.
Conceptually, it would be something like this:
 
-------
MySession>>handleRequest: aRequest
    "This is not code, only an intention of what I would like to do"
 | answer |
 
 self root visiblePresentersDo: [:each | each beforeRequestHandling].
 
 answer := super handleRequest: aRequest.
 
 self root visiblePresentersDo: [:each | each afterRequestHandling].
 
 ^answer
 
-------
 
the reason to do that is that I have some WAComponents of mine which have to lock a resource during the rendering and the callbacks handling. Right now, I'm locking and releasing the resource every time I need to (for instance, in the #renderContentOn: method, but also inside every callback), but I would prefer each component to do it automatically during each request, so I can fogert about it.
 
The question is: can something like that be done (I mean, would it work for scriptacolous callbacks too and that sort of things) ? And if it is, where and how should I do it ?
 
thanks in advance
martin

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

Re: notifying all the visible components before and after a request is received

Lukas Renggli
> The question is: can something like that be done (I mean, would it work for
> scriptacolous callbacks too and that sort of things) ? And if it is, where
> and how should I do it ?

You might want to override #renderContentOn: and
#processChildCallback: within your root component, or within a
decoration that you add around your root component.

Lukas

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

RE: notifying all the visible components before and after arequest is received

Sebastian Sastre-2
In reply to this post by Martin Rubi
Hi Martin,

        firstly I expect you found a way to achieve your requeriments. Secondly,
a word of caution about locking. Have you really need to lock in render time?
That could slow down your render and, which is worst, will create a point of
contention for the service of your application.

        Maybe you find a way to do the lock thing in a non syncronous process
preventing your render of being a guaranteed bottleneck.

        cheers,
 
Sebastian

 
________________________________

        De: [hidden email]
[mailto:[hidden email]] En nombre de Martin Rubi
        Enviado el: MiĆ©rcoles, 16 de Abril de 2008 15:09
        Para: [hidden email]
        Asunto: [Seaside] notifying all the visible components before and after
arequest is received
       
       
        Hi.
        I'd like to notify all of the visible presenters before and after a
request is handled.
        Conceptually, it would be something like this:
         
        -------
        MySession>>handleRequest: aRequest
            "This is not code, only an intention of what I would like to do"
         | answer |
         
         self root visiblePresentersDo: [:each | each beforeRequestHandling].
         
         answer := super handleRequest: aRequest.
         
         self root visiblePresentersDo: [:each | each afterRequestHandling].
         
         ^answer
         
        -------
         
        the reason to do that is that I have some WAComponents of mine which
have to lock a resource during the rendering and the callbacks handling. Right
now, I'm locking and releasing the resource every time I need to (for instance,
in the #renderContentOn: method, but also inside every callback), but I would
prefer each component to do it automatically during each request, so I can
fogert about it.
         
        The question is: can something like that be done (I mean, would it work
for scriptacolous callbacks too and that sort of things) ? And if it is, where
and how should I do it ?
         
        thanks in advance
        martin


_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside