|
Fish & Chips Club 4.10.0.0 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Object hirondelle.fish.all.preferences.Login
public final class Login
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 |
---|
public Login()
Method Detail |
---|
public boolean hasAlreadyReacted(HttpSession aSession)
Controller.LOCALE
is in session scope.
hasAlreadyReacted
in interface LoginTasks
public void reactToUserLogin(HttpSession aSession, HttpServletRequest aRequest) throws AppException
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
.
reactToUserLogin
in interface LoginTasks
AppException
|
Fish & Chips Club 4.10.0.0 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |