From c049cb3fd26dbf537a065e9537db2338b9c7248b Mon Sep 17 00:00:00 2001 From: Alexander Marsalek Date: Mon, 14 Jun 2021 11:17:55 +0200 Subject: v4.1.7-RC-0.0.8 changed post formular parameter handling to sbp:keyA=valueA&sbp:keyB=valueB --- .../pdfas/web/helper/PdfAsParameterExtractor.java | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) (limited to 'pdf-as-web/src/main/java') 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 77d6d217..1ec94c86 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 final String PARAM_DYNAMIC_SIGNATURE_BLOCK_PARAMETER = "sbp:"; public static String getConnector(HttpServletRequest request) { String connector = (String)request.getAttribute(PARAM_CONNECTOR); @@ -86,18 +86,17 @@ public class PdfAsParameterExtractor { 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); + + Enumeration parameterNames = request.getAttributeNames(); + while(parameterNames.hasMoreElements()) { + String parameterName = parameterNames.nextElement(); + if (parameterName.startsWith(PARAM_DYNAMIC_SIGNATURE_BLOCK_PARAMETER)) { + String key = parameterName.substring(PARAM_DYNAMIC_SIGNATURE_BLOCK_PARAMETER.length()); + String value = (String) request.getAttribute(parameterName); + signatureBlockParametersMap.put(key, value); } - String[] values = s.split("=", 2); - signatureBlockParametersMap.put(values[0], values[1]); } - return signatureBlockParametersMap; + return signatureBlockParametersMap; } public static String getQRCodeContent(HttpServletRequest request) { String qrcodeContent = (String)request.getAttribute(PARAM_QRCODE_CONTENT); -- cgit v1.2.3