[Seaside] 3.0 session/request redirect

Julian Fitzell jfitzell at gmail.com
Mon Feb 22 19:34:38 UTC 2010

On Mon, Feb 22, 2010 at 11:23 AM, radoslav hodnicak <rh at 4096.sk> wrote:
> On Mon, 22 Feb 2010, Philippe Marschall wrote:
>> 2010/2/22 radoslav hodnicak <rh at 4096.sk>:
>>> I have an outside form submitting login information to enter my seaside
>>> app,
>>> so as a first thing I want to do a redirect if the login info is correct,
>>> to
>>> keep browser from resubmitting the info. In my session #start I do
>>> ... process login info, save user
>>> self requestContext redirect.
>>> but when this code runs it gives me a 'You can only #call: and #answer:
>>> from
>>> within a callback or a Task.' error. Why?
>> Because control flow is only supported in the callback phase.
>> Moving your login code to #initialRequest: of you root component (you
>> don't need the redirect) should fix your problem.
> I think this is something that changed between 2.8 and 3.0 - 'cause 2.8 is
> doing the first redirect by itself.
> 2.8
> plain html page with form
>  -> post to /seaside/seasideApp
>  -> seaside page, urlbar show address like
>  server.com/seaside/seasideApp?_s=...&_k=...
> 3.0
> plain html page with form
>  -> post to /seasideApp
>  -> seaside page, urlbar show address like
>  server.com/seasideApp
> there's no session or key parameter which means there was no initial
> redirect. This is a problem

Actually, it was an often-requested feature. :) We used to have to do
a redirect, now we don't.

I intended to add a config option that would cause WAApplication
(actually WARegistry, probably) to do an initial redirect with the
session key, but haven't got around to it.

You probably also don't need the code after the redirect to keep
running, do you? Unfortunately, #call:/#answer: is implemented by the
RenderLoop and #start is what invokes the render loop, so you can't do
a call there. But of you don't need #call: behaviour, you can just do
a redirect. Try:

self requestContext redirectTo: self url


More information about the seaside mailing list