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/java/at/knowcenter/wag/egov/egiz/PdfAS.java | 2 +- src/main/java/at/knowcenter/wag/egov/egiz/cfg/SettingsReader.java | 1 + .../at/knowcenter/wag/egov/egiz/sig/connectors/bku/BKUHelper.java | 1 + .../egiz/sig/connectors/mocca/LocRefDetachedMOCCAConnector.java | 6 +++--- .../knowcenter/wag/egov/egiz/sig/sigid/DetachedMOCIdFormatter.java | 2 +- .../java/at/knowcenter/wag/egov/egiz/web/ExternAppInformation.java | 6 ++++++ src/main/java/at/knowcenter/wag/egov/egiz/web/FormFields.java | 2 ++ .../java/at/knowcenter/wag/egov/egiz/web/SessionAttributes.java | 5 +++++ .../at/knowcenter/wag/egov/egiz/web/servlets/DataURLServlet.java | 2 +- .../at/knowcenter/wag/egov/egiz/web/servlets/ProvidePDFServlet.java | 2 +- .../java/at/knowcenter/wag/egov/egiz/web/servlets/SignServlet.java | 3 ++- 11 files changed, 24 insertions(+), 8 deletions(-) (limited to 'src/main/java/at/knowcenter/wag') diff --git a/src/main/java/at/knowcenter/wag/egov/egiz/PdfAS.java b/src/main/java/at/knowcenter/wag/egov/egiz/PdfAS.java index 302e8cb..d150f70 100644 --- a/src/main/java/at/knowcenter/wag/egov/egiz/PdfAS.java +++ b/src/main/java/at/knowcenter/wag/egov/egiz/PdfAS.java @@ -96,7 +96,7 @@ public abstract class PdfAS * The current version of the pdf-as library. This version string is logged on every invocation * of the api or the web application. */ - public static final String PDFAS_VERSION = "3.0.9-20090129"; + public static final String PDFAS_VERSION = "3.0.9-20090203"; /** * The key of the strict mode setting. diff --git a/src/main/java/at/knowcenter/wag/egov/egiz/cfg/SettingsReader.java b/src/main/java/at/knowcenter/wag/egov/egiz/cfg/SettingsReader.java index 6cd5e61..bca5b17 100644 --- a/src/main/java/at/knowcenter/wag/egov/egiz/cfg/SettingsReader.java +++ b/src/main/java/at/knowcenter/wag/egov/egiz/cfg/SettingsReader.java @@ -394,6 +394,7 @@ public class SettingsReader implements Serializable logger_.info(" configuration path = \"" + CONFIG_PATH + "\""); logger_.info(" certstore path = \"" + CERT_PATH + "\""); logger_.info(" temporary path = \"" + TMP_PATH + "\""); + logger_.info(" file.encoding = \"" + System.getProperty("file.encoding") + "\""); logger_.info(StringUtils.repeat("*", length + 25)); IAIK.addAsProvider(); diff --git a/src/main/java/at/knowcenter/wag/egov/egiz/sig/connectors/bku/BKUHelper.java b/src/main/java/at/knowcenter/wag/egov/egiz/sig/connectors/bku/BKUHelper.java index cec8d6f..af155a1 100644 --- a/src/main/java/at/knowcenter/wag/egov/egiz/sig/connectors/bku/BKUHelper.java +++ b/src/main/java/at/knowcenter/wag/egov/egiz/sig/connectors/bku/BKUHelper.java @@ -110,6 +110,7 @@ public final class BKUHelper */ public static void checkResponseForError(String response_string) throws ConnectorException { + log.debug("Checking response for error: " + response_string); Pattern erc_p_s = Pattern.compile("<[\\w]*:?ErrorCode>"); //$NON-NLS-1$ Pattern erc_p_e = Pattern.compile(""); //$NON-NLS-1$ Matcher erc_m_s = erc_p_s.matcher(response_string); diff --git a/src/main/java/at/knowcenter/wag/egov/egiz/sig/connectors/mocca/LocRefDetachedMOCCAConnector.java b/src/main/java/at/knowcenter/wag/egov/egiz/sig/connectors/mocca/LocRefDetachedMOCCAConnector.java index fcfe006..30212eb 100644 --- a/src/main/java/at/knowcenter/wag/egov/egiz/sig/connectors/mocca/LocRefDetachedMOCCAConnector.java +++ b/src/main/java/at/knowcenter/wag/egov/egiz/sig/connectors/mocca/LocRefDetachedMOCCAConnector.java @@ -547,10 +547,10 @@ public class LocRefDetachedMOCCAConnector implements Connector, LocalConnector { * @return The common part of all id attributes. */ protected String parseSigId(String sigIdString) { - int pos = sigIdString.indexOf("@"); + String[] parts = sigIdString.split("@"); String result = null; - if (pos != -1) { - result = sigIdString.substring(pos+1).trim(); + if (parts != null && parts.length > 1) { + result = parts[1].trim(); } return result; } diff --git a/src/main/java/at/knowcenter/wag/egov/egiz/sig/sigid/DetachedMOCIdFormatter.java b/src/main/java/at/knowcenter/wag/egov/egiz/sig/sigid/DetachedMOCIdFormatter.java index c942b73..ae46225 100644 --- a/src/main/java/at/knowcenter/wag/egov/egiz/sig/sigid/DetachedMOCIdFormatter.java +++ b/src/main/java/at/knowcenter/wag/egov/egiz/sig/sigid/DetachedMOCIdFormatter.java @@ -16,7 +16,7 @@ import at.knowcenter.wag.egov.egiz.exceptions.SettingsException; */ public class DetachedMOCIdFormatter implements IdFormatter { - public static String SIG_ID_PREFIX = "etsi-moc-1.0"; + public static final String SIG_ID_PREFIX = "etsi-moc-1.0"; /** * Key value in property file diff --git a/src/main/java/at/knowcenter/wag/egov/egiz/web/ExternAppInformation.java b/src/main/java/at/knowcenter/wag/egov/egiz/web/ExternAppInformation.java index 73f10aa..d00ec61 100644 --- a/src/main/java/at/knowcenter/wag/egov/egiz/web/ExternAppInformation.java +++ b/src/main/java/at/knowcenter/wag/egov/egiz/web/ExternAppInformation.java @@ -12,11 +12,17 @@ public class ExternAppInformation implements Serializable { public String invoke_url; public long pdf_id; public String session_id; + public String invoke_error_url; public ExternAppInformation(String url, String id, String session_id) { + this(url, id, session_id, null); + } + + public ExternAppInformation(String url, String id, String session_id, String errorUrl) { this.invoke_url = url; this.pdf_id = Long.parseLong(id); this.session_id = session_id; + this.invoke_error_url = errorUrl; } } diff --git a/src/main/java/at/knowcenter/wag/egov/egiz/web/FormFields.java b/src/main/java/at/knowcenter/wag/egov/egiz/web/FormFields.java index ad480cc..7b8164a 100644 --- a/src/main/java/at/knowcenter/wag/egov/egiz/web/FormFields.java +++ b/src/main/java/at/knowcenter/wag/egov/egiz/web/FormFields.java @@ -88,6 +88,8 @@ public abstract class FormFields public static final String FIELD_FILE_LENGTH = "num-bytes"; public static final String FIELD_INVOKE_APP_URL = "invoke-app-url"; + + public static final String FIELD_INVOKE_APP_ERROR_URL = "invoke-app-error-url"; public static final String FIELD_SESSION_ID = "session-id"; diff --git a/src/main/java/at/knowcenter/wag/egov/egiz/web/SessionAttributes.java b/src/main/java/at/knowcenter/wag/egov/egiz/web/SessionAttributes.java index f4956be..1a7d90f 100644 --- a/src/main/java/at/knowcenter/wag/egov/egiz/web/SessionAttributes.java +++ b/src/main/java/at/knowcenter/wag/egov/egiz/web/SessionAttributes.java @@ -54,4 +54,9 @@ public abstract class SessionAttributes */ public static final String DOWNLOAD_URL_FOR_SIGNED_PDF_DOCUMENT = "java.lang.String:downloadURL"; + /** + * The notification url of an external webapplication. + */ + public static final String PARENT_WEBAPP_REDIRECT_URL = "java.lang.String:parentWebAppRedirectURL"; + } diff --git a/src/main/java/at/knowcenter/wag/egov/egiz/web/servlets/DataURLServlet.java b/src/main/java/at/knowcenter/wag/egov/egiz/web/servlets/DataURLServlet.java index 16352de..f74bd1c 100644 --- a/src/main/java/at/knowcenter/wag/egov/egiz/web/servlets/DataURLServlet.java +++ b/src/main/java/at/knowcenter/wag/egov/egiz/web/servlets/DataURLServlet.java @@ -277,7 +277,7 @@ public class DataURLServlet extends HttpServlet // redirect to download.jsp but return the sign-response immediately if (si.exappinf != null) { log.debug("Entering external application interface mode. Skipping redirection to download page."); - SignServletHelper.returnSignResponse(si, response); + SignServletHelper.returnSignResponse(si, request, response); // Not needed due to redirection of returnSignResponse. // Just to clarify that there must not be any code after returnSignResponse. diff --git a/src/main/java/at/knowcenter/wag/egov/egiz/web/servlets/ProvidePDFServlet.java b/src/main/java/at/knowcenter/wag/egov/egiz/web/servlets/ProvidePDFServlet.java index 1efc64f..c40f3c6 100644 --- a/src/main/java/at/knowcenter/wag/egov/egiz/web/servlets/ProvidePDFServlet.java +++ b/src/main/java/at/knowcenter/wag/egov/egiz/web/servlets/ProvidePDFServlet.java @@ -61,7 +61,7 @@ public class ProvidePDFServlet extends HttpServlet { log.debug("Returning signed pdf to browser."); // log.debug("Invalidating session."); // session.invalidate(); - SignServletHelper.returnSignResponse(si, response); + SignServletHelper.returnSignResponse(si, request, response); return; } } else { diff --git a/src/main/java/at/knowcenter/wag/egov/egiz/web/servlets/SignServlet.java b/src/main/java/at/knowcenter/wag/egov/egiz/web/servlets/SignServlet.java index 589de7c..792a3e1 100644 --- a/src/main/java/at/knowcenter/wag/egov/egiz/web/servlets/SignServlet.java +++ b/src/main/java/at/knowcenter/wag/egov/egiz/web/servlets/SignServlet.java @@ -184,6 +184,7 @@ public class SignServlet extends HttpServlet String pdf_id = (String) request.getParameter(FormFields.FIELD_PDF_ID); String pdf_length = (String) request.getParameter(FormFields.FIELD_FILE_LENGTH); String invoke_url = (String) request.getParameter(FormFields.FIELD_INVOKE_APP_URL); + String invoke_error_url = (String) request.getParameter(FormFields.FIELD_INVOKE_APP_ERROR_URL); String session_id = (String) request.getParameter(FormFields.FIELD_SESSION_ID); String sig_pos_y = (String) request.getParameter(FormFields.FIELD_SIGPOS_Y); String sig_pos_p = (String) request.getParameter(FormFields.FIELD_SIGPOS_P); @@ -227,7 +228,7 @@ public class SignServlet extends HttpServlet ud = ud_extern; - exappinf = new ExternAppInformation(invoke_url, pdf_id, session_id); + exappinf = new ExternAppInformation(invoke_url, pdf_id, session_id, invoke_error_url); } else { -- cgit v1.2.3