[Seaside] How to set/get cookies?

Tim Mackinnon tim at testit.works
Thu May 3 18:29:53 UTC 2018


Thanks - that #requestContext was the bit I was missing.

Is this documented anywhere obvious? I searched all over to find something and couldn't easily discover it. None of the tutorials dig into this, nor the Seaside book (I guess we could get it updated as I think seaside still has legs to it).

Possibly we could put a comment in WACookie - as I found it? Or maybe a more e2e test?

Tim

Sent from my iPhone

> On 3 May 2018, at 16:38, Johan Brichau <johan at inceptive.be> wrote:
> 
> Hi Tim,
> 
> Getting cookies, by accessing the WARequest instance from within your callback/rendering code:
> 
>    self requestContext request cookieAt: ‘myCookie'
> 
> Setting cookies, by accessing the WAResponse instance from within your rendering code:
> 
>    self requestContext response addCookie: 
>        (self requestContext newCookie
>                path:’/myApp';
>                key: ‘myCookie';
>                value: ‘myCookie').
> 
> Hope this puts you on your way!
> 
> Cheers
> Johan
> 
>> On 3 May 2018, at 12:28, Tim Mackinnon <tim at testit.works> wrote:
>> 
>> Hi - I’m trying to get back into seaside, and I’m trying to understand how you get/set cookies? I can see WACookie and WARequest has a #cookieAt: method - but I’m missing the key piece about where in your application lifecycle you can access these things to store for example a user preference (without going full hog with a database).
>> 
>> Tim
>> _______________________________________________
>> 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