* the event to all the listeners registered.
*/
protected void initSession() {
log.debug("New session created. Firing event");
for (int i = 0; i < listeners.length; i++) {
ControllerListener listener = listeners[i];
listener.initSession(getRequest(), getResponse());
}
// Catch the user preferred language.
PreferredLocale preferredLocale = getPreferredLocale(getRequest());
LocaleManager.lookup().setCurrentLocale(preferredLocale.asLocale());
// Store a HttpBindingListener object to detect session expiration
getRequest().getSession().setAttribute(SESSION_ATTRIBUTE_BIND_LISTENER, new HttpSessionBindingListener() {
public void valueBound(HttpSessionBindingEvent httpSessionBindingEvent) {
}
public void valueUnbound(HttpSessionBindingEvent httpSessionBindingEvent) {
for (int i = 0; i < listeners.length; i++) {
ControllerListener listener = listeners[i];
listener.expireSession(httpSessionBindingEvent.getSession());
}
}
});
getRequest().getSession().setAttribute(SESSION_ATTRIBUTE_INITIALIZED, "true");
}