[Helma-user] Suppressing Session creation?

Maksim Lin for technical support mailling lists maksim_lin at ngv.vic.gov.au
Thu Jul 26 01:46:32 CEST 2007


Hi Joshua,

Having a quick look at SessionManger code, its actually a very simple
class and would be very easy to subclass to create a custom one (as a
side note - I guess it should really be converted to an interface at
some point, rather then having to have people subclass the existing
class...) 
So thanks for your question, its been educational to learn it would be
fairly straight forward to implement distributed session management for
instance by storing the sessions in a central db location...

BUT I don't think writing a custom SessionManager is the easiest way to
implement what you want anyways - since other parts of Helma (like the
req handling code) expect there to always be an existing session object
and the helma login code expects to have a session object to attach a
user object too, rather then creating a new session object when you call
session.login()

Discarding the session as you ask may be the easiest way to go for your
situation and there is even a discard() method already defined in
SessionManager java class, so you could have code like this in an
action:

res.writeln("session count before delete:"+app.countSessions());
    
var appObject = app.__app__;
var sessionMgr = appObject.getSessionManager();
sessionMgr.discardSession(sessionMgr.getSession(session._id));
    
res.writeln("session count after delete:"+app.countSessions());

BUT I HIGHLY RECOMMMEND you test this bit of hackery quite thoroughly as
I suspect that there may be side effects! 
But it should work as it looks like the only place in helma java code
that discardSession currently gets called is in
Application.cleanupSessions() which first grabs the current sessions
before trying to discard them so it should cope ok with you discarding
sessions in your app.

good luck,

Maks.


> -----Original Message-----
> From: helma-user-bounces at helma.org 
> [mailto:helma-user-bounces at helma.org] On Behalf Of Joshua Paine
> Sent: Thursday, 26 July 2007 07:19
> To: Helma User Mailing List
> Subject: Re: [Helma-user] Suppressing Session creation?
> 
> Michael Platzer wrote:
> > implement your own SessionManager
> 
> I'm glad that's possible, but let me tell you how eager I am to do it.
> 
> Ok, done. ;-)
> 
> > There is currently no way to suppress the creation of sessions
> 
> To take another approach, is there a way I could just delete 
> the Session on the same page? I assume Session creation is 
> not particularly expensive, so that might be almost as good.
> 
> If sessions can't be deleted, that brings up another issue I 
> had--how do I logout a user?
> 
> -Joshua
> _______________________________________________
> Helma-user mailing list
> Helma-user at helma.org
> http://helma.org/mailman/listinfo/helma-user
> 
> 
> 


More information about the Helma-user mailing list