[Seaside] hot to use response during action phase?

Lukas Renggli renggli at gmail.com
Sat Mar 7 08:55:48 UTC 2009


> 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


More information about the seaside mailing list