[Seaside] hot to use response during action phase?

Julian Fitzell jfitzell at gmail.com
Sat Mar 7 15:50:54 UTC 2009


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
>


More information about the seaside mailing list