tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christopher Schultz <>
Subject Re: How to detect user logins
Date Tue, 21 Aug 2007 13:37:09 GMT
Hash: SHA1


David Delbecq wrote:
> Current strategy works (it's separated in 2 steps inside a common-chain
> of operation), but it makes wuite a few lines to try to detect user
> login, and if tomcat was already providing such event that could be
> handled by a context listener, that would have been, perhaps, cleaner.

How about an HttpSessionListener? It looks like what you really want is
a LoginListener or something like that, which doesn't exist in the spec.
You could always write your own Realm by subclassing an existing one and
adding such notification (or even stuff your magic "needs-upgrade"
object into the session.

I still don't think you'll be saving yourself that much work. Null
checks are cheap, and since they can be deployed on any app server and
any version (good luck when you upgrade Tomcat if you're subclasses the
Realm), I would recommend the more manageable solution over the
(potentially) faster one.

- -chris

> En l'instant précis du 20/08/07 17:41, Christopher Schultz s'exprimait
> en ces termes:
>> David,
>> David Delbecq wrote:
>>> For now, the layout is Filter that check userPrincipal. If user
>>> principal is not null for the first time, issues that check, mark
>>> that user got checked for next times, in session, and continue query.
>>>  However, if i could mark the session as "need upgrade" upon login,
>>> this would make things, i think, easier to manage as filter would
>>> only need to look for that "need upgrade" flag.
>> I think you'll find that you're just breaking your filter into two
>> separate filters: you'd have one that check to see if the session "needs
>> an upgrade", and then another one to "upgrade" it. Since the
>> functionality is all related, I'm not sure if there's a good reason not
>> to keep it all together.
>> Do you have any particular complaints about your existing strategy?
>> -chris
> ---------------------------------------------------------------------
> To start a new topic, e-mail:
> To unsubscribe, e-mail:
> For additional commands, e-mail:
Version: GnuPG v1.4.7 (MingW32)
Comment: Using GnuPG with Mozilla -


To start a new topic, e-mail:
To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message