aboutsummaryrefslogtreecommitdiff
path: root/pdf-as-web/src/main/java
diff options
context:
space:
mode:
authorThomas <>2023-06-27 08:56:21 +0200
committerThomas <>2023-06-27 08:56:21 +0200
commitca7b9d0863dcc1c02849a23db66310146f91c104 (patch)
treef8f1400fe8d1f9771bbccf4d26414948bf37dd0a /pdf-as-web/src/main/java
parentcc26fbd157a39ea243d1d253e6b62f38ccad244e (diff)
downloadpdf-as-4-ca7b9d0863dcc1c02849a23db66310146f91c104.tar.gz
pdf-as-4-ca7b9d0863dcc1c02849a23db66310146f91c104.tar.bz2
pdf-as-4-ca7b9d0863dcc1c02849a23db66310146f91c104.zip
feat(web): add request parameter to enable/disable QR-code placeholder searching on request level
Diffstat (limited to 'pdf-as-web/src/main/java')
-rw-r--r--pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/helper/PdfAsHelper.java3
-rw-r--r--pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/helper/PdfAsParameterExtractor.java16
-rw-r--r--pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/servlets/ExternSignServlet.java1
3 files changed, 17 insertions, 3 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 0de8ca71..5db82e3a 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
@@ -539,6 +539,7 @@ public class PdfAsHelper {
// set Signature Position
signParameter.setSignaturePosition(documentToSign.getPosition());
signParameter.setPlaceHolderId(documentToSign.getPlaceHolderId());
+ signParameter.setPlaceHolderSearchEnabled(documentToSign.isPlaceholderSearchEnabled());
// Set Preprocessor
if (coreParams.getPreprocessor() != null) {
@@ -664,7 +665,7 @@ public class PdfAsHelper {
// set Signature Position
signParameter.setSignaturePosition(pdfToSign.getPosition());
signParameter.setPlaceHolderId(pdfToSign.getPlaceHolderId());
-
+ signParameter.setPlaceHolderSearchEnabled(pdfToSign.isPlaceholderSearchEnabled());
signParameter.setDynamicSignatureBlockArguments(coreSignParams.getSignatureBlockParameters());
return pdfAs.startSign(signParameter);
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 31fbf46d..1ed85e98 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
@@ -30,11 +30,13 @@ import java.util.Map;
import javax.servlet.http.HttpServletRequest;
-import at.gv.egiz.pdfas.lib.api.IConfigurationConstants;
-import at.gv.egiz.pdfas.lib.api.verify.VerifyParameter.SignatureVerificationLevel;
+import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import at.gv.egiz.pdfas.lib.api.IConfigurationConstants;
+import at.gv.egiz.pdfas.lib.api.verify.VerifyParameter.SignatureVerificationLevel;
+
public class PdfAsParameterExtractor {
public static final String PARAM_CONNECTOR = "connector";
@@ -118,6 +120,16 @@ public class PdfAsParameterExtractor {
return (String)request.getAttribute(IConfigurationConstants.PLACEHOLDER_WEB_ID);
}
+ public static boolean isPlaceholderSearchEnabled(HttpServletRequest request) {
+ String value = (String)request.getAttribute(IConfigurationConstants.PLACEHOLDER_WEB_ENABLED);
+ if (StringUtils.isNotEmpty(value)) {
+ return Boolean.valueOf(value);
+
+ } else {
+ return true;
+ }
+ }
+
public static String getTransactionId(HttpServletRequest request) {
String transactionId = (String)request.getAttribute(PARAM_TRANSACTION_ID);
return transactionId;
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 b9f3f3de..0123e30d 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
@@ -380,6 +380,7 @@ public class ExternSignServlet extends HttpServlet {
document.setPosition(PdfAsHelper.buildPosString(request, response));
document.setProfile(PdfAsParameterExtractor.getSigType(request));
document.setPlaceHolderId(PdfAsParameterExtractor.getPlaceholderId(request));
+ document.setPlaceholderSearchEnabled(PdfAsParameterExtractor.isPlaceholderSearchEnabled(request));
document.setQrCodeContent(qrcodeContent);
document.setFileName(PdfAsHelper.getPDFFileName(request));
data.addDocumentToSign(document);