I have an internal website with several web applications, and thus several
contexts.  The user's identity is automatically provided via jCIFs (NTLM
authentication).  At the start of a session, a UserDataBean is created that
loads user preferences from a database, including the language preference
for the user (the site is English/Japanese bilingual).

I've implemented a site-wide filter that checks for changes to preferences
sent as a querystring by clicking a link (e.g., clicking on the 'nihon-go'
link in the main menu sends the URL [current path]?Language=JA).  The filter
catches the change, calls the change method in the session's UserDataBean,
which changes the preference and updates the database.

The experienced among you have already spotted the problem: with multiple
contexts there are multiple sessions for the user, and multiple
UserDataBeans; changing a preference in one bean doesn't change the
preference in another bean, which has already populated its fields from the
database.  Switch to Japanese in one context, and the change isn't reflected
in another.

What I think will work is the create a UserDataBeanEvent that is broadcast
on changing a preference; all the other beans listen for that event, and on
receiving one, check if that event was sent by a bean for the same user as
the receiving UserDataBean; if it was, it can update its own fields to the
same value (without bothering to update the database since the broadcasting
bean did so), and so all the UserDataBeans are co-ordinated across multiple
contexts.

Does this seem workable?  Am I forgetting something, or am I missing
something about performance?  Is there a lighter-weight way to accomplish
the same thing?

Thanks,
Justin

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to