On Tue, Sep 15, 2009 at 12:09 PM, measwel <marek_karczew...@yahoo.com.au>wrote:
> > As I understand one can: > > 1) user = userManager.getUserByUsername(getRequest().getRemoteUser()); > > 2) user = getCurrentUser(UserManager userManager, boolean > forceReloadInCurrentSession) > > 3) get the user from Acegi session. This is probably the code : > String currentUser; > if (auth.getPrincipal() instanceof UserDetails) { > currentUser = ((UserDetails) > auth.getPrincipal()).getUsername(); > } else { > currentUser = String.valueOf(auth.getPrincipal()); > } > > > Which one is prefferable? The first 2 make a DB roundtrip, while nr 3 does > not right? > I would recommend #3. > -- > View this message in context: > http://www.nabble.com/exception-thrown-when-trying-to-get-current-user-tp25458093s2369p25458920.html > Sent from the AppFuse - User mailing list archive at Nabble.com. > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscr...@appfuse.dev.java.net > For additional commands, e-mail: users-h...@appfuse.dev.java.net > >