Thinking about cookies...


Post #: 22
Post type: Blog post
Date: 2012-09-25 00:07:42.000
Author: Rocket Man

In order to get separate users to sign on and post messages, I need to set some cookies. This leads me to what I call a Cookie Conundrum.

I can define a function to set cookies that is executed somewhere in the page (like rockets-main.lsp) But cookies are set in the header, using the line Set-Cookie. The header is the first thing printed out by the script, and I won't know what the cookie is until later in the script.

What Dragonfly does is caches everything being (print)ed and (println)ed into a big old global variable called STDOUT. Then at the very end of the script it prints the headers (which have already been calculated by the script) followed by STOUT. This involves overriding (changing the default behavior) of (print) and (println). I could do that, but is there a way to do it differently? Can you set a cookie and somehow have it remember to print that cookie in the next header on the following page?

It's something to think about...


View this post in the forums

Views: 4721