[Seaside] Issue with #checkForCookies

German Viscuso netquake at speedy.com.ar
Thu Jul 21 22:41:52 CEST 2005


Thanks for the tip, I have no previous experience with seaside so I didn't
know of the class WATask.
Now I'm checking for cookies from a "go" method in a subclass of WATask but
the problem persists.
It seems to be an issue with WASession>>checkForCookies , this method checks
for cookies by setting a test cookie:

checkForCookies
 | check |
 check := WAExternalID new asString.
 self redirectWithCookie:
  (WACookie new
   key: check;
   value: 'yes';
   expireIn: (Duration seconds: 2);
   yourself).
 ^ currentRequest cookies includesKey: check

I do not understand why it is forcing a redirect (which seems to be the
cause of the warning message). Also, if I try to set a cookie myself via
#redirectWithCookie: I obtain the same warning message (so the problem may
be there). As I've read from a previous thread in this list "Cookies
(again?)" the idea is to force a redirect that sets the cookie and then
comes right back, but I wonder: is it imperative to set a cookie with a
redirect?

Regards and thank you.

GV

----- Original Message ----- 
From: "Julian Fitzell" <julian at beta4.com>
To: "The Squeak Enterprise Aubergines Server - general discussion."
<seaside at lists.squeakfoundation.org>
Sent: 21 July, 2005 15:25
Subject: Re: [Seaside] Issue with #checkForCookies


> Hi German,
>
> Well, to be honest I think the cookie stuff was added after I left for
> Australia so I'm not really familiar with it.  But, what I immediately
> notice from your code snippet is that you are answering directly from
> inside a render method, which is a bit unusual.  Since your render
> method doesn't actually do any rendering, the example you provide below
> would be much better encapsulated in a subclass of WATask (just put all
> that code inside the #go method).
>
> A task allows you to run through a multistep process, asking questions
> and defining program flow, whereas a component is really designed to be
> shown to the user.  It's perfectly acceptable to call #inform: or
> #answer: inside a callback block that will be triggered by the user and
> executed during the execution phase.  But once the execution phase has
> been run and it has been determined that your component should be
> rendered, you don't want to be calling out to another component.
>
> Does that make sense?
>
> Julian
>
> German Viscuso wrote:
> > Hello list.
> >
> > When I try to use #checkForCookies in a seaside component I obtain the
> > following
> > message in the Transcript:
> >
> > "Warning: You have tried to set a cookie and a redirect in the same
page,
> > responding
> > to the request /seaside/go/myapp. Some browsers will not handle this
> > correctly."
> >
> > Has this issue been already reported or solved? (I'm using VW 7.3 nc and
the
> > web toolkit)
> >
> > My test code is:
>
> --------------------------------------------------------------------------
-
> > renderContentOn: html
> >
> > self session checkForCookies
> >  ifTrue: [
> >   self inform: 'Cookies enabled!'.
> >   self answer: 'ok']
> >  ifFalse: [
> >   self inform: 'You must have cookies enabled to proceed.'.
> >   self answer: nil ]
>
> --------------------------------------------------------------------------
-
> >
> > Regards and thanks in advance,
> >
> > GV
> >
> > _______________________________________________
> > Seaside mailing list
> > Seaside at lists.squeakfoundation.org
> > http://lists.squeakfoundation.org/listinfo/seaside
>
> -- 
>    Julian Fitzell  --  Beta4 Productions
> julian at beta4.com  --  http://www.beta4.com
> Seaside: http://seaside.st/
> _______________________________________________
> Seaside mailing list
> Seaside at lists.squeakfoundation.org
> http://lists.squeakfoundation.org/listinfo/seaside
>



More information about the Seaside mailing list