Today's Smalltalk Daily looks at how to add cookies to a WebVelocity 1.1 web component. Since WebVelocity 1.1 is built on Seaside 3.0, this is a whole lot easier than it used to be. If you're using WebVelocity 1.0 (or Seaside 2.8 outside of WebVelocity), then have a look at this screencast in order to see how it used to work. You can go directly to YouTube if you can't see the embedded video below. The code to add a cookie is really simple - here's the trivial example from the screencast:
renderContentOn: html | response cookie | response := self requestContext response. cookie := self requestContext newCookie. cookie key: 'helloCookie'. cookie value: '2'. cookie comment: 'Example Only'. response addCookie: cookie. html text: 'Hello There'.
To watch now, click on the viewer below:
You can follow the Smalltalk channel on YouTube for all the "Smalltalk Daily" videos. You can also check out the videos on Vimeo, where the quality is higher, or over on Facebook, if you are a member.