[Seaside-dev] RE: [Seaside] hot to use response during action phase?

Lukas Renggli renggli at gmail.com
Mon Mar 9 15:43:56 UTC 2009


> We've been meaning to do an a3 for a few weeks now. Lukas, can we
> temporarily revert that updateUrl: change and release an a3? I'd could
> do it myself but I don't know how; perhaps you could document all the
> steps when you do it this time so someone else can fill in in the
> future? (unless you want to keep doing them eternally, of course :) ).

Yeah, do revert it. Other things are broken though, such as the styles
of the tools.

Lukas


>
> Julian
>
> On Mon, Mar 9, 2009 at 3:10 PM, Sebastian Sastre <ssastre at seaswork.com> wrote:
>> you dont hit the halt?! wtf..
>> this is a pharo 243 image with all the updates and seaside 2.9a2 loaded using
>> the attachment
>> (I tried to upgrade with Lukas instructions but I get stuck at some point
>> (unresponsive UI).
>> what can I do? if I have to migrate to another image which one would work?
>> thanks
>> sebastian
>>
>>> -----Mensaje original-----
>>> De: seaside-dev-bounces at lists.squeakfoundation.org
>>> [mailto:seaside-dev-bounces at lists.squeakfoundation.org] En
>>> nombre de Julian Fitzell
>>> Enviado el: Monday, March 09, 2009 11:06
>>> Para: Seaside - developer list
>>> Asunto: Re: [Seaside-dev] RE: [Seaside] hot to use response
>>> during action phase?
>>>
>>> Hm... I don't hit that halt so I don't seem to be able to reproduce. I
>>> far as I can tell by looking, your code looks fine. In fact, if I
>>> change your #addCookie method as follows then I actually get a cookie
>>> added:
>>>
>>> addCookie
>>>       "If response is nil here, I can't cookie :('"
>>>       self requestContext response addCookie:
>>>               (self requestContext newCookie
>>>                       key: 'foo';
>>>                       value: 'bar';
>>>                       yourself)
>>>
>>> How old is the Seaside code you are using?
>>>
>>> (by the way, you can just call "self requestContext"; you don't need
>>> "self session requestContext")
>>>
>>> Julian
>>>
>>> On Mon, Mar 9, 2009 at 1:41 PM, Sebastian Sastre
>>> <ssastre at seaswork.com> wrote:
>>> > Hi Julian, I'm sending you a demo with the problem
>>> > best,
>>> > sebastian
>>> >
>>> >> -----Mensaje original-----
>>> >> De: seaside-dev-bounces at lists.squeakfoundation.org
>>> >> [mailto:seaside-dev-bounces at lists.squeakfoundation.org] En
>>> >> nombre de Julian Fitzell
>>> >> Enviado el: Sunday, March 08, 2009 06:23
>>> >> Para: Seaside - developer list
>>> >> Asunto: Re: [Seaside-dev] RE: [Seaside] hot to use response
>>> >> during action phase?
>>> >>
>>> >> Can you show the code that is calling this method?
>>> >>
>>> >> On Sat, Mar 7, 2009 at 5:18 PM, Sebastian Sastre
>>> >> <ssastre at seaswork.com> wrote:
>>> >> > hi Julian,
>>> >> > you're right, dev is better for this.
>>> >> > Look, in a WASession subclass I have this piece of code:
>>> >> >
>>> >> >  self requestContext response
>>> >> >                        addCookie: (WACookie new
>>> >> >                                                key: self
>>> >> loginRememberKey;
>>> >> >                                                value:
>>> >> loginCookieValue;
>>> >> >                                                yourself)
>>> >> >
>>> >> > and I can see the request context is called from the
>>> >> process variable and it is
>>> >> > not nil but its response instVar is nil and I found that's
>>> >> inconvenient
>>> >> > cheers,
>>> >> > seaside
>>> >> >
>>> >> >
>>> >> >> -----Mensaje original-----
>>> >> >> De: seaside-bounces at lists.squeakfoundation.org
>>> >> >> [mailto:seaside-bounces at lists.squeakfoundation.org] En nombre
>>> >> >> de Julian Fitzell
>>> >> >> Enviado el: Saturday, March 07, 2009 12:51
>>> >> >> Para: Seaside - general discussion
>>> >> >> Asunto: Re: [Seaside] hot to use response during action phase?
>>> >> >>
>>> >> >> How are you calling #response on WASession? it should be self
>>> >> >> requestContext response addCookie:
>>> >> >>
>>> >> >> Are you storing the request context somewhere? That would
>>> >> be the most
>>> >> >> likely cause of the response being nil. You need to make
>>> >> sure to call
>>> >> >> "self requestContext" at the point that you want to use to
>>> >> make sure
>>> >> >> you are using the correct current context...
>>> >> >>
>>> >> >> Julian
>>> >> >>
>>> >> >> On Sat, Mar 7, 2009 at 4:33 PM, Sebastian Sastre
>>> >> >> <ssastre at seaswork.com> wrote:
>>> >> >> > Hi Lukas, yes I've read that in the seaside site and code
>>> >> >> so I was counting with
>>> >> >> > that and I find it cool. So I made my code to be using it
>>> >> >> like that. The problem
>>> >> >> > comes because the request context returns nil when
>>> >> >> #response is sent at that
>>> >> >> > point.
>>> >> >> > In the walkback I can see this is happening during the
>>> >> >> action phase continuation
>>> >> >> > evaluation, then reach my component, it announces something
>>> >> >> other reacts and
>>> >> >> > asks:
>>> >> >> > self session response addCookie: self newLoginCookie
>>> >> >> > and then I have a nil DNU #addCookie:
>>> >> >> > there could be a problem on *when* the response inst var is
>>> >> >> initialized in the
>>> >> >> > request context? why the response is not initialized right
>>> >> >> from the begining
>>> >> >> > (request context fabrication)?
>>> >> >> > thanks
>>> >> >> > sebastian
>>> >> >> >
>>> >> >> >> -----Mensaje original-----
>>> >> >> >> De: seaside-bounces at lists.squeakfoundation.org
>>> >> >> >> [mailto:seaside-bounces at lists.squeakfoundation.org] En nombre
>>> >> >> >> de Lukas Renggli
>>> >> >> >> Enviado el: Saturday, March 07, 2009 05:56
>>> >> >> >> Para: Seaside - general discussion
>>> >> >> >> Asunto: Re: [Seaside] hot to use response during
>>> action phase?
>>> >> >> >>
>>> >> >> >> > I need to manipulate a couple cookies from the app and when
>>> >> >> >> porting from 2.8 to
>>> >> >> >> > 2.9 I've noticed the action phase has not available the
>>> >> >> >> response in the request
>>> >> >> >> > context.
>>> >> >> >>
>>> >> >> >> In Seaside 2.9 every request is processed with a
>>> request context
>>> >> >> >> (instance of WARequestContext). The request context is
>>> >> >> instantiated by
>>> >> >> >> the sever adaptor and knows all the necessary things to
>>> >> process a
>>> >> >> >> request. It holds the request (instance of WARequest) and
>>> >> >> the response
>>> >> >> >> (instance of WAResponse). Furthermore, it also knows
>>> the current
>>> >> >> >> application and session if available.
>>> >> >> >>
>>> >> >> >> So adding cookies is much easier in Seaside 2.9. There is
>>> >> >> no need to
>>> >> >> >> do a redirect anymore, because the response that is sent
>>> >> >> back to the
>>> >> >> >> browser is known upfront. Simply ask the request
>>> context for the
>>> >> >> >> current response and add your cookies in the callback or
>>> >> >> render phase:
>>> >> >> >>
>>> >> >> >>     self requestContext response addCookie: ...
>>> >> >> >>
>>> >> >> >> Cheers,
>>> >> >> >> Lukas
>>> >> >> >>
>>> >> >> >> --
>>> >> >> >> Lukas Renggli
>>> >> >> >> http://www.lukas-renggli.ch
>>> >> >> >> _______________________________________________
>>> >> >> >> seaside mailing list
>>> >> >> >> seaside at lists.squeakfoundation.org
>>> >> >> >>
>>> >> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>>> >> >> >
>>> >> >> > _______________________________________________
>>> >> >> > seaside mailing list
>>> >> >> > seaside at lists.squeakfoundation.org
>>> >> >> >
>>> >> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>>> >> >> >
>>> >> >> _______________________________________________
>>> >> >> seaside mailing list
>>> >> >> seaside at lists.squeakfoundation.org
>>> >> >>
>>> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>>> >> >
>>> >> > _______________________________________________
>>> >> > seaside-dev mailing list
>>> >> > seaside-dev at lists.squeakfoundation.org
>>> >> > http://lists.squeakfoundation.org/mailman/listinfo/seaside-dev
>>> >> >
>>> >> _______________________________________________
>>> >> seaside-dev mailing list
>>> >> seaside-dev at lists.squeakfoundation.org
>>> >> http://lists.squeakfoundation.org/mailman/listinfo/seaside-dev
>>> >
>>> > _______________________________________________
>>> > seaside-dev mailing list
>>> > seaside-dev at lists.squeakfoundation.org
>>> > http://lists.squeakfoundation.org/mailman/listinfo/seaside-dev
>>> >
>>> >
>>> _______________________________________________
>>> seaside-dev mailing list
>>> seaside-dev at lists.squeakfoundation.org
>>> http://lists.squeakfoundation.org/mailman/listinfo/seaside-dev
>>
>> _______________________________________________
>> seaside-dev mailing list
>> seaside-dev at lists.squeakfoundation.org
>> http://lists.squeakfoundation.org/mailman/listinfo/seaside-dev
>>
>>
> _______________________________________________
> seaside-dev mailing list
> seaside-dev at lists.squeakfoundation.org
> http://lists.squeakfoundation.org/mailman/listinfo/seaside-dev
>



-- 
Lukas Renggli
http://www.lukas-renggli.ch


More information about the seaside-dev mailing list