public static void afterRoot(
      FacesContext context, HttpServletRequest req, HttpServletResponse res) {
    HttpSession session = ((HttpServletRequest) req).getSession(false);

    if (session != null)
      session.setAttribute(ViewHandler.CHARACTER_ENCODING_KEY, res.getCharacterEncoding());
  }
 /**
  * @param _request
  * @param _response
  * @throws IOException
  */
 private void redirectToErrorPage(HttpServletRequest _request, HttpServletResponse _response)
     throws IOException {
   if (!"".equals(_errorPage)) {
     _response.sendRedirect(_request.getContextPath() + _errorPage);
   }
 }