[Bese-devel] web sessions

Marco Baringer mb at bese.it
Thu Jul 22 15:20:03 UTC 2004


i was hoping to post this as an annotation on the docs, but due to
some weird system issues the server has lost write access to
itself. go figure.

any way, the question was regarding components and sessions and
whether two components' idea of what the current user name was could
get out of sync.

the answer is yes, that is very possible. what i'd like to point out
though is that putting the user name in a component isn't really a
great idea to begin with (unless it's an edit-username
component). session global data like that should really go in the
session object, and you'd access thove values with accessor defined on
your session class. so now you're all asking yourselves, how do i do
that?

the idea is that you'd define a subclass of standard-session and tell
your application to use that instead of standard-session. currently
this requires a bit more work than it should:

(defclass my-application-class (standard-application)
  ())

(defmethod application.session-type ((app my-application-class))
  'my-session)

(defclass my-session (standard-session)
  (...))

(defapplication my-app
  (:class 'my-application-class)
  ... other defapplication args ...)

that could fairly easily be reduced to a :session-class argument on
defapplication, but it's done so rarely (iow once) that i haven't
bothered. i'm currently entertainig the idea of putting a lazily
created eql hash-table in standard-session and adding a
get-session-value and (setf get-session-value) generic function.

hth.
-- 
-Marco
Ring the bells that still can ring.
Forget your perfect offering.
There is a crack in everything.
That's how the light gets in.
     -Leonard Cohen




More information about the bese-devel mailing list