Oh boy ... this was a long journey. Finally, I came up with a third
alternative: a filter. 

I came across a few posts and found the LocaleFilter. In principle, I copied
it and added a few more
lines. Now, the workflow is like this:

1. check if a remote user exists; if not then process as LocaleFilter does.
2. if a user exists, get the userManager bean and retrieve the user by name.
3. get the users preferred language and set it as the locale; proceed as
LocaleFilter does.

Don't forget to point the localeFilter in the web.xml to your
Implementation.

Note, because web.xml has no notion of dependency injection, nor is there a
straightforward way
of retrieving beans from the Spring application context and wiring them into
a servlet filter, I used
Spring's WebApplicationContextUtils.

   ApplicationContext ctx = WebApplicationContextUtils
      .getWebApplicationContext(getServletContext());
   UserManager userManager = (UserManager) ctx.getBean("userManager");          
        

Martin

-- 
View this message in context: 
http://www.nabble.com/How-to-change-the-locale-programmatically-tp18706402s2369p18713038.html
Sent from the AppFuse - User mailing list archive at Nabble.com.


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

Reply via email to