aboutsummaryrefslogtreecommitdiff
path: root/pdf-as-web
diff options
context:
space:
mode:
authorThomas <>2023-06-26 21:11:26 +0200
committerThomas <>2023-06-26 21:11:26 +0200
commit8e0ccca7cfd1680e33737e0db8d6e1091661568c (patch)
tree33ae7a462976eecbda355921706412a1ff60131a /pdf-as-web
parent203eaa42d83da699ed9cc6c7e286906b5aeb6d44 (diff)
downloadpdf-as-4-8e0ccca7cfd1680e33737e0db8d6e1091661568c.tar.gz
pdf-as-4-8e0ccca7cfd1680e33737e0db8d6e1091661568c.tar.bz2
pdf-as-4-8e0ccca7cfd1680e33737e0db8d6e1091661568c.zip
refact(placeholder): clean-up, bugfix and optimize QR-Code placeholder detection
Major re-factoring of QR-Code detection with huge clean-up of code.
Diffstat (limited to 'pdf-as-web')
-rw-r--r--pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/helper/PdfAsHelper.java6
-rw-r--r--pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/servlets/ExternSignServlet.java17
2 files changed, 5 insertions, 18 deletions
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);