@Override
    public void doFilter(ServletRequest request, ServletResponse response,
            FilterChain chain)
            throws IOException, ServletException {

        HttpSession session = ((HttpServletRequest)request).getSession(true);
        Locale locale = (Locale) session.getAttribute(JSP_LOCALE);
        if (locale == null) {
            if (defLocale != null) {
                session.setAttribute(JSP_LOCALE, defLocale);
            } else {
                Locale loc = response.getLocale();
                session.setAttribute(JSP_LOCALE, response.getLocale());
            }
        }

        chain.doFilter(request, response);
    }