<%
String serverUrl=LocalRequestHelper.getLocalServerAddress(request,response);
String baseUrl=LocalRequestHelper.getLocalContextAddress(request,response);
//Check if application is started within an iframe from an extern application
boolean startedFromIFrame = false;
String extern = (String)session.getAttribute("extern");
if (extern!=null) {
if (extern.equals("yes")) {
startedFromIFrame = true;
}
}
//
String language = (String)session.getAttribute(SessionAttributes.LANGUAGE);
String height = (String)session.getAttribute(SignServlet.HEIGHT_SIGN_DIV);
boolean german = true;
if (language!=null) {
if (language.equals("de")) {%>
<% } else {
german = false; %>
<% }
}
else { %>
<% } %>
<%
//Check if error happened within IFrame (e.g. if Online-BKU was called)
String iframe = (String)session.getAttribute(SignServlet.ERROR_WITHIN_IFRAME);
boolean withiniframe = false;
if (iframe!=null) {
if (iframe.equals("yes")) {
withiniframe = true;
}
}
%>
<%
//First part: if not within IFrame and the whole application also was not started within an IFrame
//we have to set the buergerkarte page as template
//Second part is because mobile has redirect target _top and in case of cancel it would be redirected
//from what this prevents
if (((!withiniframe) && (!startedFromIFrame)) || ((!startedFromIFrame) && (((String)request.getAttribute("cause")).contains("Abbruch durch den Bürger über die Benutzerschnittstelle")))) {
if (german) { %>
<% } else { %>
<% } %>
<% } %>
<%
//If the whole application started from an IFrame there could be an external stylesheet
if (!startedFromIFrame) { %>
<% } else { %>
<% } %>
<%
String redirect = null;
PdfAsException pe=null;
boolean paramInvok = false;
boolean rb = false;
boolean isExternalInvocation = false;
String cause="";
String error="";
if (exception != null && exception instanceof PdfAsException)
{
pe = (PdfAsException)exception;
SignServlet.prepareDispatchToErrorPage(pe, request);
} else {
pe = (PdfAsException)request.getAttribute("PresentableException");
}
error = (String)request.getParameter("error");
if (error == null) {
error = (request.getAttribute("error") == null ? "" : request.getAttribute("error").toString());
} else {
paramInvok = true;
}
cause = (String)request.getParameter("cause");
if (cause == null) {
cause = (request.getAttribute("cause") == null ? "" : request.getAttribute("cause").toString());
} else {
paramInvok = true;
}
rb = Boolean.TRUE.equals((Boolean) request.getAttribute("resourcebundle"));
Object sessionInfo = session.getAttribute(SessionAttributes.ATTRIBUTE_SESSION_INFORMATION);
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 = null;
if(si.exappinf.invoke_error_url.contains("?")) {
errorUrl = si.exappinf.invoke_error_url + "&" + urlParams;
} else {
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");
response.sendRedirect(redirectHelper);
}
}
}
boolean testMode = request.getContextPath().startsWith("/test-");
//If application not started within an iframe
if (!startedFromIFrame) { %>
<%
//First condition: if error didn't happen within IFrame (e.g. when local bku is called) the whole site has to be shown
//Second condition is because mobile has to have redirect target _top to redirect
//in case of successfull signature. But because of this also in case of cancel redirects
if ((!withiniframe) || (cause.contains("Abbruch durch den Bürger über die Benutzerschnittstelle"))) { %>
<%
if ((testMode) ) {
%>
<% } else { %>
<% } // end if %>
:
<%= cause%>
" alt="Signatur mit Karte" disabled="disabled"/>
" alt="Signatur mit Handy" disabled="disabled"/>
<%}
//Just the error decription has to be shown
else { %>