From 29ad090c29567ff1a4d3a2ec9b8ad0b5d80ee24d Mon Sep 17 00:00:00 2001 From: pdanner Date: Mon, 6 Dec 2010 16:34:52 +0000 Subject: git-svn-id: https://joinup.ec.europa.eu/svn/pdf-as/trunk@671 7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c --- pdf-as-web/src/main/webapp/jsp/error.jsp | 109 +++++++++++++++++++++++++++++++ 1 file changed, 109 insertions(+) create mode 100644 pdf-as-web/src/main/webapp/jsp/error.jsp (limited to 'pdf-as-web/src/main/webapp/jsp/error.jsp') diff --git a/pdf-as-web/src/main/webapp/jsp/error.jsp b/pdf-as-web/src/main/webapp/jsp/error.jsp new file mode 100644 index 0000000..fc7ff1b --- /dev/null +++ b/pdf-as-web/src/main/webapp/jsp/error.jsp @@ -0,0 +1,109 @@ +<%@ page isErrorPage="true" %> +<%@ page import="at.gv.egiz.pdfas.web.helper.LocalRequestHelper" %> +<%@ page import="at.gv.egiz.pdfas.web.servlets.SignServlet" %> +<%@page import="at.gv.egiz.pdfas.api.exceptions.PdfAsException"%> +<%@ page import="at.gv.egiz.pdfas.web.session.SignSessionInformation" %> +<%@ page import="at.gv.egiz.pdfas.web.session.VerifySessionInformation" %> +<%@ page import="at.gv.egiz.pdfas.web.session.SessionAttributes" %> +<%@ page import="org.apache.commons.httpclient.util.EncodingUtil" %> +<%@ page import="org.apache.commons.httpclient.NameValuePair" %> +<%@ page import="at.gv.egiz.pdfas.web.helper.SignServletHelper" %> +<%@ page import="org.apache.commons.lang.StringEscapeUtils" %> +<%@ page import="java.io.*" %> + +<%@ include file="language.jsp" %> + + + + + + <fmt:message key="error.title"/> + + + + + + +<% + PdfAsException pe; + if (exception != null && exception instanceof PdfAsException) + { + pe = (PdfAsException)exception; + SignServlet.prepareDispatchToErrorPage(pe, request); + } else { + pe = (PdfAsException)request.getAttribute("PresentableException"); + } + + String error = request.getParameter("error"); + boolean paramInvok = false; + if (error == null) { + error = (request.getAttribute("error") == null ? "" : request.getAttribute("error").toString()); + } else { + paramInvok = true; + } + String cause = request.getParameter("cause"); + if (cause == null) { + cause = (request.getAttribute("cause") == null ? "" : request.getAttribute("cause").toString()); + } else { + paramInvok = true; + } + boolean rb = Boolean.TRUE.equals((Boolean) request.getAttribute("resourcebundle")); + Object sessionInfo = session.getAttribute(SessionAttributes.ATTRIBUTE_SESSION_INFORMATION); + + boolean isExternalInvocation = false; + if (sessionInfo != null) { + if (sessionInfo instanceof SignSessionInformation) { + SignSessionInformation si = (SignSessionInformation) sessionInfo; + isExternalInvocation = (si != null && si.exappinf != null); + if (isExternalInvocation) { + String urlParams = EncodingUtil.formUrlEncode(new NameValuePair[] { new NameValuePair("error", error), new NameValuePair("cause", cause) }, "ISO8859_1"); + if (si.exappinf.invoke_error_url == null) { + // prevent circular redirect + si.exappinf = null; + String redirectUrl = response.encodeRedirectURL(request.getContextPath() + "/jsp/error.jsp" + "?" + urlParams); + session.setAttribute(SessionAttributes.PARENT_WEBAPP_REDIRECT_URL, redirectUrl); + } else { + String errorUrl = si.exappinf.invoke_error_url + "?" + urlParams; + session.setAttribute(SessionAttributes.PARENT_WEBAPP_REDIRECT_URL, errorUrl); + } + String redirectHelper = response.encodeRedirectURL(request.getContextPath() + "/jsp/redirect_to_parent.jsp"); + SignServletHelper.disableBrowserCacheForResponse(response); + response.sendRedirect(redirectHelper); + } + } + } + +%> + + +

+

+
+ <% if (rb) { %> + + <% } else { out.write(StringEscapeUtils.escapeHtml(error)); } %> +
+
: + <% if (rb) { %> + + <% } else { out.write(StringEscapeUtils.escapeHtml(cause)); } %> +
+ <% if (!isExternalInvocation && !paramInvok) { %> +
+ + <% } // end if %> +
+		<%
+		  if (pe != null) {
+		    StringWriter sw = new StringWriter();
+		    PrintWriter pw = new PrintWriter(sw);
+		    pe.printStackTrace(pw);
+		    sw.close();
+		    pw.close();
+		    out.print(StringEscapeUtils.escapeHtml(sw.toString()));
+		  }
+		%>
+		
+ + + -- cgit v1.2.3