A look at how to add cookies to a WebVelocity 1.1 web component.
A look 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. 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’.
If you have trouble viewing that directly, you can click here to download the video directly. If you need the video in a Windows Media format, then download that here.