* @throws ServletException forwarded from handler chain
* @throws IOException forwarded from handler chain
*/
public void onAuthenticationSuccess(HttpServletRequest request, HttpServletResponse response,
Authentication authentication) throws ServletException, IOException {
JCUser user = (JCUser) authentication.getPrincipal();
userService.updateLastLoginTime(user);
logger.info("JCUser logged in: " + user.getUsername());
//apply language settings assuming CookieLocaleResolver usage
String languageCode = user.getLanguage().getLanguageCode();
LocaleResolver localeResolver = new CookieLocaleResolver();
localeResolver.setLocale(request, response, user.getLanguage().getLocale());
Cookie cookie = new Cookie(CookieLocaleResolver.DEFAULT_COOKIE_NAME, languageCode);
cookie.setPath("/");
response.addCookie(cookie);
super.onAuthenticationSuccess(request, response, authentication);
}