Session management with webrick

Hi gurus and nubys,

I’m playing a little with webrick, and I’m having great fun with it.
I’m writing a little app using some ERB pages and Madeleine as the
data store, but I’m now wondering how to handle user sessions
(basically I just need to pass a pair of vars from page to page).

The only thing I can think of is to use CGI/session and a MemoryStore,
but I wonder if there is some better method built in webrick.

Any hint ?

Install Borges [1] :slight_smile:

Seriously, you could send back a cookie or hidden form field, and make
an association in your data store between the cookie value and the
session, just like CGI/Session does.

[1] http://borges.rubyforge.org/

···

gabriele renzi (surrender_it@rc1.vip.ukl.yahoo.com) wrote:

Hi gurus and nubys,

I’m playing a little with webrick, and I’m having great fun with it.
I’m writing a little app using some ERB pages and Madeleine as the
data store, but I’m now wondering how to handle user sessions
(basically I just need to pass a pair of vars from page to page).

The only thing I can think of is to use CGI/session and a MemoryStore,
but I wonder if there is some better method built in webrick.

Any hint ?


Eric Hodel - drbrain@segment7.net - http://segment7.net
All messages signed with fingerprint:
FEC2 57F1 D465 EB15 5D6E 7C11 332A 551C 796C 9F04

You may also want to look at webrick/cookie.rb.

···

Eric Hodel (drbrain@segment7.net) wrote:

gabriele renzi (surrender_it@rc1.vip.ukl.yahoo.com) wrote:

Hi gurus and nubys,

I’m playing a little with webrick, and I’m having great fun with it.
I’m writing a little app using some ERB pages and Madeleine as the
data store, but I’m now wondering how to handle user sessions
(basically I just need to pass a pair of vars from page to page).

The only thing I can think of is to use CGI/session and a MemoryStore,
but I wonder if there is some better method built in webrick.

Any hint ?

Seriously, you could send back a cookie or hidden form field, and make
an association in your data store between the cookie value and the
session, just like CGI/Session does.


Eric Hodel - drbrain@segment7.net - http://segment7.net
All messages signed with fingerprint:
FEC2 57F1 D465 EB15 5D6E 7C11 332A 551C 796C 9F04