From fd72ba6f0bf8a797fcc5e340fc5a963aef35eaca Mon Sep 17 00:00:00 2001 From: Alexander Marsalek Date: Fri, 11 Jun 2021 15:36:58 +0200 Subject: version 4.1.7-RC-0.0.7, added sbp parameter to ExternSignServlet --- build.gradle | 2 +- doc/AnbindungExterneWebanwendung.docx | Bin 467163 -> 472247 bytes doc/AnbindungExterneWebanwendung.pdf | Bin 404599 -> 621439 bytes .../pdfas/web/helper/PdfAsParameterExtractor.java | 19 +++++++++++++++++-- .../egiz/pdfas/web/servlets/ExternSignServlet.java | 7 ++----- pdf-as-web/src/main/webapp/index.jsp | 3 +++ 6 files changed, 23 insertions(+), 8 deletions(-) diff --git a/build.gradle b/build.gradle index a88543f4..2fab1550 100644 --- a/build.gradle +++ b/build.gradle @@ -12,7 +12,7 @@ buildscript { allprojects { apply plugin: "com.github.ben-manes.versions" repositories { mavenCentral() } - version = '4.1.7-RC-0.0.6' + version = '4.1.7-RC-0.0.7' } configurations { diff --git a/doc/AnbindungExterneWebanwendung.docx b/doc/AnbindungExterneWebanwendung.docx index 42e26e72..bde3191b 100644 Binary files a/doc/AnbindungExterneWebanwendung.docx and b/doc/AnbindungExterneWebanwendung.docx differ diff --git a/doc/AnbindungExterneWebanwendung.pdf b/doc/AnbindungExterneWebanwendung.pdf index 3ae63741..38823d05 100644 Binary files a/doc/AnbindungExterneWebanwendung.pdf and b/doc/AnbindungExterneWebanwendung.pdf differ diff --git a/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/helper/PdfAsParameterExtractor.java b/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/helper/PdfAsParameterExtractor.java index 5415b233..77d6d217 100644 --- a/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/helper/PdfAsParameterExtractor.java +++ b/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/helper/PdfAsParameterExtractor.java @@ -74,7 +74,7 @@ public class PdfAsParameterExtractor { public static final String PARAM_PREPROCESSOR_PREFIX = "pp:"; public static final String PARAM_OVERWRITE_PREFIX = "ov:"; public static final String PARAM_QRCODE_CONTENT = "qrcontent"; - + public static final String PARAM_DYNAMIC_SIGNATURE_BLOCK_PARAMETER = "sbp"; public static String getConnector(HttpServletRequest request) { String connector = (String)request.getAttribute(PARAM_CONNECTOR); @@ -83,7 +83,22 @@ public class PdfAsParameterExtractor { } return PARAM_CONNECTOR_DEFAULT; } - + + public static Map getDynamicSignatureBlockParameters(HttpServletRequest request) throws Exception { + HashMap signatureBlockParametersMap = new HashMap(); + String sbpString = (String) request.getAttribute(PARAM_DYNAMIC_SIGNATURE_BLOCK_PARAMETER); +// Map map = request.getParameterMap(); + if(sbpString == null || sbpString.length() == 0) + return signatureBlockParametersMap; + for(String s : sbpString.split(";")){ + if(!s.contains("=")) { + throw new Exception("Invalid parameter: "+s); + } + String[] values = s.split("=", 2); + signatureBlockParametersMap.put(values[0], values[1]); + } + return signatureBlockParametersMap; + } public static String getQRCodeContent(HttpServletRequest request) { String qrcodeContent = (String)request.getAttribute(PARAM_QRCODE_CONTENT); return qrcodeContent; diff --git a/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/servlets/ExternSignServlet.java b/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/servlets/ExternSignServlet.java index 841b8428..674d3351 100644 --- a/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/servlets/ExternSignServlet.java +++ b/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/servlets/ExternSignServlet.java @@ -350,12 +350,10 @@ public class ExternSignServlet extends HttpServlet { PlaceholderWebConfiguration.clear(); } - } catch(Exception e) { logger.error(e.getLocalizedMessage()); } - String filename = PdfAsParameterExtractor.getFilename(request); if(filename != null) { logger.debug("Setting Filename in session: " + filename); @@ -367,9 +365,8 @@ public class ExternSignServlet extends HttpServlet { PdfAsHelper.setSignatureDataHash(request, pdfDataHash); logger.debug("Storing signatures data hash: " + pdfDataHash); - //TODO alex parse?? - Map dynamicSignatureBlockArguments = null; - + Map dynamicSignatureBlockArguments = + PdfAsParameterExtractor.getDynamicSignatureBlockParameters(request); logger.debug("Starting signature creation with: " + connector); diff --git a/pdf-as-web/src/main/webapp/index.jsp b/pdf-as-web/src/main/webapp/index.jsp index c07b2cc0..5a904374 100644 --- a/pdf-as-web/src/main/webapp/index.jsp +++ b/pdf-as-web/src/main/webapp/index.jsp @@ -24,6 +24,9 @@ + <% } %> -- cgit v1.2.3