From 8e0ccca7cfd1680e33737e0db8d6e1091661568c Mon Sep 17 00:00:00 2001 From: Thomas <> Date: Mon, 26 Jun 2023 21:11:26 +0200 Subject: refact(placeholder): clean-up, bugfix and optimize QR-Code placeholder detection Major re-factoring of QR-Code detection with huge clean-up of code. --- .../java/at/gv/egiz/pdfas/web/helper/PdfAsHelper.java | 6 ++++-- .../gv/egiz/pdfas/web/servlets/ExternSignServlet.java | 17 +---------------- 2 files changed, 5 insertions(+), 18 deletions(-) (limited to 'pdf-as-web/src/main/java/at/gv') diff --git a/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/helper/PdfAsHelper.java b/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/helper/PdfAsHelper.java index b29228c0..3ac91cab 100644 --- a/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/helper/PdfAsHelper.java +++ b/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/helper/PdfAsHelper.java @@ -536,7 +536,8 @@ public class PdfAsHelper { // set Signature Position signParameter.setSignaturePosition(documentToSign.getPosition()); - + signParameter.setPlaceHolderId(documentToSign.getPlaceHolderId()); + // Set Preprocessor if (coreParams.getPreprocessor() != null) { signParameter.setPreprocessorArguments(coreParams.getPreprocessor()); @@ -660,7 +661,8 @@ public class PdfAsHelper { // set Signature Position signParameter.setSignaturePosition(pdfToSign.getPosition()); - + signParameter.setPlaceHolderId(pdfToSign.getPlaceHolderId()); + signParameter.setDynamicSignatureBlockArguments(coreSignParams.getSignatureBlockParameters()); return pdfAs.startSign(signParameter); 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 898e44e2..b9f3f3de 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 @@ -46,10 +46,8 @@ import at.gv.egiz.pdfas.common.exceptions.PDFASError; import at.gv.egiz.pdfas.common.exceptions.PdfAsException; import at.gv.egiz.pdfas.common.exceptions.PdfAsSettingsValidationException; import at.gv.egiz.pdfas.common.settings.ISettings; -import at.gv.egiz.pdfas.lib.api.IConfigurationConstants; import at.gv.egiz.pdfas.lib.api.PdfAsFactory; import at.gv.egiz.pdfas.lib.api.verify.VerifyParameter.SignatureVerificationLevel; -import at.gv.egiz.pdfas.lib.impl.configuration.PlaceholderWebConfiguration; import at.gv.egiz.pdfas.web.config.WebConfiguration; import at.gv.egiz.pdfas.web.exception.PdfAsWebException; import at.gv.egiz.pdfas.web.filter.UserAgentFilter; @@ -346,20 +344,6 @@ public class ExternSignServlet extends HttpServlet { String responseMode = PdfAsParameterExtractor.getResonseMode(request); PdfAsHelper.setResponseMode(request, response, responseMode); - - //read and set placholder web id - try{ - String placeholder_id = PdfAsParameterExtractor.getPlaceholderId(request); - if(org.apache.commons.lang3.StringUtils.isNotEmpty(placeholder_id)) { - PlaceholderWebConfiguration.setValue(IConfigurationConstants.PLACEHOLDER_WEB_ID, placeholder_id); - } else { - PlaceholderWebConfiguration.clear(); - } - - } catch(Exception e) { - log.error(e.getLocalizedMessage()); - } - String filename = PdfAsParameterExtractor.getFilename(request); if(filename != null) { log.debug("Setting Filename in session: " + filename); @@ -395,6 +379,7 @@ public class ExternSignServlet extends HttpServlet { document.setInputData(pdfData); document.setPosition(PdfAsHelper.buildPosString(request, response)); document.setProfile(PdfAsParameterExtractor.getSigType(request)); + document.setPlaceHolderId(PdfAsParameterExtractor.getPlaceholderId(request)); document.setQrCodeContent(qrcodeContent); document.setFileName(PdfAsHelper.getPDFFileName(request)); data.addDocumentToSign(document); -- cgit v1.2.3