Retrieving or setting multiple cookies

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Retrieving or setting multiple cookies

Esteban A. Maringolo
Hi,

Which is the way to set or retrieve multiple cookies from aWARequest?

WARequests implements #hasCookie and #cookie methods, but It isn't
very clear if they can respond more than one cookie.

#cookie will answer a GenericHeaderField, which could be parsed to
retrieve more than one cookie.
But how to set more than one?
a GenericHeaderField with name "Set-Cookie" would be useful to set one
cookie at a time.

Best regards,


--
Esteban A. Maringolo
[hidden email]


Reply | Threaded
Open this post in threaded view
|

RE: Retrieving or setting multiple cookies

Bany, Michel
Esteban,

Have a look to the Seaside port to Swazoo.

Load SeasideForSwazoo from the Cincom public store
and examine bundle "Seaside-Swazoo". There is a class
named SeasideResource with two interesting methods
#convertRequest: and #convertResponse:

The first method convert a Swazoo request into a WARequest
for this, we use the instance creation method
#method:url:headers:fields:cookies:
which takes collections (dictionaries) are the last three arguments.

The argument for the collection of cookies is constructed
by method #unwrapCookies: that parses the cookie from Swazoo.

The second method converts a WAResponse into a Swazoo
response. Last time I ported to Swazoo, there were no
support for outbound cookies in Swazoo. I had to implement
my own Swazoo.HTTPCookie class. When there are multiple
outbound cookies, you need to generate multiple 'Set-Cookie'
header, one for each cookie.

Hope this helps.

Enjoy,
Michel.



 

> -----Original Message-----
> From: [hidden email]
> [mailto:[hidden email]] On Behalf
> Of Esteban A. Maringolo
> Sent: Tuesday, November 01, 2005 6:40 PM
> To: Swazoo List
> Subject: [Swazoo-devel] Retrieving or setting multiple cookies
>
> Hi,
>
> Which is the way to set or retrieve multiple cookies from aWARequest?
>
> WARequests implements #hasCookie and #cookie methods, but It
> isn't very clear if they can respond more than one cookie.
>
> #cookie will answer a GenericHeaderField, which could be
> parsed to retrieve more than one cookie.
> But how to set more than one?
> a GenericHeaderField with name "Set-Cookie" would be useful
> to set one cookie at a time.
>
> Best regards,
>
>
> --
> Esteban A. Maringolo
> [hidden email]
>
>
> -------------------------------------------------------
> SF.Net email is sponsored by:
> Tame your development challenges with Apache's Geronimo App
> Server. Download it for free - -and be entered to win a 42"
> plasma tv or your very own Sony(tm)PSP.  Click here to play:
> http://sourceforge.net/geronimo.php
> _______________________________________________
> Swazoo-devel mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/swazoo-devel
>