From 03875a41dd5b065c8ab0c04268ac9371f51a8639 Mon Sep 17 00:00:00 2001 From: tknall Date: Wed, 4 Feb 2009 09:10:02 +0000 Subject: Some more log messages (e.g. encoding related issues). Updating web application (in external invocation mode) enhancing support for being used within an iframe. Two new (optional) parameters for external invocation mode: locale: defines the locale being used for webapp (e.g. locale=de or locale=de_DE), invoke-app-error-url: can be used to declare a callback url to the calling web application in order to transfer error messages from pdf-as. In case of error pdf-as redirects the user to the error-page-url (if given) providing the error and the cause in url encoded parameters ("error", "cause"). Formatter for mocca signature params enhanced. git-svn-id: https://joinup.ec.europa.eu/svn/pdf-as/trunk@323 7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c --- src/main/webapp/jsp/error.jsp | 44 +++++++++++++++++++++++--- src/main/webapp/jsp/null_request_page.jsp | 51 +++++++++++++++++++++--------- src/main/webapp/jsp/redirect_to_parent.jsp | 24 ++++++++++++++ 3 files changed, 100 insertions(+), 19 deletions(-) create mode 100644 src/main/webapp/jsp/redirect_to_parent.jsp (limited to 'src/main/webapp/jsp') diff --git a/src/main/webapp/jsp/error.jsp b/src/main/webapp/jsp/error.jsp index 2183a62..4bd49a4 100644 --- a/src/main/webapp/jsp/error.jsp +++ b/src/main/webapp/jsp/error.jsp @@ -2,6 +2,10 @@ <%@ page import="at.knowcenter.wag.egov.egiz.web.LocalRequestHelper" %> <%@ page import="at.knowcenter.wag.egov.egiz.web.servlets.SignServlet" %> <%@ page import="at.knowcenter.wag.egov.egiz.exceptions.*" %> +<%@ page import="at.gv.egiz.pdfas.web.SignSessionInformation" %> +<%@ page import="at.knowcenter.wag.egov.egiz.web.SessionAttributes" %> +<%@ page import="org.apache.commons.httpclient.util.EncodingUtil" %> +<%@ page import="org.apache.commons.httpclient.NameValuePair" %> <%@ page import="java.io.*" %> <%@ include file="language.jsp" %> @@ -22,9 +26,39 @@ SignServlet.prepareDispatchToErrorPage(pe, request); } - String error = (request.getAttribute("error") == null ? "" : request.getAttribute("error").toString()); - String cause = (request.getAttribute("cause") == null ? "" : request.getAttribute("cause").toString()); + 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")); + SignSessionInformation si = (SignSessionInformation) session.getAttribute(SessionAttributes.ATTRIBUTE_SESSION_INFORMATION); + + boolean 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"); + response.sendRedirect(redirectHelper); + } + %> @@ -40,8 +74,10 @@ <% } else { out.write(cause); } %> -
- + <% if (!isExternalInvocation && !paramInvok) { %> +
+ + <% } // end if %>
 		<%
 		  if (pe != null) {
diff --git a/src/main/webapp/jsp/null_request_page.jsp b/src/main/webapp/jsp/null_request_page.jsp
index 4dd3d02..6d1008a 100644
--- a/src/main/webapp/jsp/null_request_page.jsp
+++ b/src/main/webapp/jsp/null_request_page.jsp
@@ -2,16 +2,18 @@
 <%@ page import="at.knowcenter.wag.egov.egiz.web.servlets.UpdateFormServlet"%>
 <%@ page import="java.util.Locale" %>
 <%@ page import="at.gv.egiz.pdfas.api.commons.Constants" %>
+<%@ page import="at.gv.egiz.pdfas.web.SignSessionInformation" %>
+<%@ page import="at.knowcenter.wag.egov.egiz.web.SessionAttributes" %>
 <%@ include file="language.jsp" %>
 <%
   String local_request_url = (String)request.getAttribute("local_request_url");
-  String data_url = (String)request.getAttribute("data_url");
-  String device = (String) session.getAttribute(UpdateFormServlet.UPLOADFORM_SIGNATURE_DEVICE_KEY);
+  String data_url = (String) request.getAttribute("data_url");
+  SignSessionInformation si = (SignSessionInformation) session.getAttribute(SessionAttributes.ATTRIBUTE_SESSION_INFORMATION);
   Locale locale = (Locale) session.getAttribute(LocaleParamFilter.LOCALE_SESSION_KEY);
   
-  boolean isOnlineMOCCA = Constants.SIGNATURE_DEVICE_MOC.equals(device); 
+  boolean isExternalInvocation = (si != null && si.exappinf != null);
+  boolean isServerBKU = Constants.SIGNATURE_DEVICE_MOC.equals(si.connector); 
 %>
-
 
 	
 		
@@ -37,10 +39,15 @@
 	
 
 	
-		

-

- <% if (isOnlineMOCCA) { %> -
+ <% if (!isExternalInvocation) { %> +

+

+ <% } // end if %> + + <% if (isServerBKU) { %> + <% if (!isExternalInvocation) { %> +
+ <% } // end if %>
@@ -50,19 +57,33 @@ <% } // end if %>
-
- + <% if (!isExternalInvocation) { %> +
+ + <% } else { // end if %> + + <% } // end if %> + <% } else { %> -
-
+ <% if (isExternalInvocation) { %> +
+ <% } else { %> +
+
+ <% } // end if %>
- " /> + <% if (!isExternalInvocation) { %> + " /> + <% } // end if %>
<% } // end if %> -
- + + <% if (!isExternalInvocation) { %> +
+ + <% } // end if %> + -- cgit v1.2.3