Fish & Chips Club 4.10.0.0

hirondelle.fish.all.preferences
Class Login

Object
  extended by hirondelle.fish.all.preferences.Login
All Implemented Interfaces:
LoginTasks

public final class Login
extends Object
implements LoginTasks

Ensures the user preferences are present in session scope.

Upon login, it is often desirable to place user preferences in the session. However, in applications which use the servlet security-constraint mechanism, user login is controlled mostly by the container. So, the issue arises of how to place user preferences into a session after successful login.

There does not seem to be any suitable items in the existing Servlet API for this task. The HttpSessionListener allows inspection of sessions that have just been created, but does not allow inspection of who has logged in.


Constructor Summary
Login()
           
 
Method Summary
 boolean hasAlreadyReacted(HttpSession aSession)
          Returns true only if an attribute named Controller.LOCALE is in session scope.
 void reactToUserLogin(HttpSession aSession, HttpServletRequest aRequest)
          Ensure the user preferences are in session scope.
 
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Login

public Login()
Method Detail

hasAlreadyReacted

public boolean hasAlreadyReacted(HttpSession aSession)
Returns true only if an attribute named Controller.LOCALE is in session scope.

Specified by:
hasAlreadyReacted in interface LoginTasks

reactToUserLogin

public void reactToUserLogin(HttpSession aSession,
                             HttpServletRequest aRequest)
                      throws AppException
Ensure the user preferences are in session scope.

In this implementation, there is only one user preference - the language (English or French). This method adds a Locale object to session scope under a key defined by Controller.LOCALE.

If there are many user preferences, and not just one, then it might make sense to place a single object into session scope, which gathers together all such preferences into a single object. Note, however, that the default implementations of LocaleSource and TimeZoneSource are not consistent with such a style, since they expect their data to be stored under separate keys defined in Controller.

Specified by:
reactToUserLogin in interface LoginTasks
Throws:
AppException

Fish & Chips Club 4.10.0.0

Copyright Hirondelle Systems - Generated 2013Oct19.12.26