/** * Redirect to the default error page. * * @param ctx request context * @param response {@link HttpServletResponse} instance */ @SuppressWarnings("unchecked") protected void redirectToDefaultErrorPage(final RequestContextHolder ctx, final HttpServletResponse response) { try { response.setContentType("text/html"); PrintWriter out = response.getWriter(); List<ValidatorError> editableErrors = (List<ValidatorError>) ctx.getSession().getAttribute(Constants.EDITABLE_PARAMETER_ERROR); ctx.getSession().removeAttribute(Constants.EDITABLE_PARAMETER_ERROR); errorPageWritter.writeErrorPage(ctx, out, editableErrors); out.flush(); } catch (IOException e) { throw new RuntimeException("Cant redirect to the default error page", e); } }