aboutsummaryrefslogtreecommitdiff
path: root/pdf-as-web/src
diff options
context:
space:
mode:
authoremusic <emina.music@egiz.gv.at>2018-03-21 17:56:48 +0100
committeremusic <emina.music@egiz.gv.at>2018-03-21 17:56:48 +0100
commit08911a1b4f7bc825841f99053cf98af795e506f2 (patch)
tree423df348b6b257ae433c08009e0762b82b0c9a0f /pdf-as-web/src
parentad3722eeda59cb2bcffa205f6ad8fbb37cf55504 (diff)
downloadpdf-as-4-08911a1b4f7bc825841f99053cf98af795e506f2.tar.gz
pdf-as-4-08911a1b4f7bc825841f99053cf98af795e506f2.tar.bz2
pdf-as-4-08911a1b4f7bc825841f99053cf98af795e506f2.zip
enabled placeholder serach for pdf-as web
Diffstat (limited to 'pdf-as-web/src')
-rw-r--r--pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/helper/PdfAsParameterExtractor.java5
-rw-r--r--pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/servlets/ExternSignServlet.java47
-rw-r--r--pdf-as-web/src/main/webapp/assets/img/localBKU.pngbin0 -> 6650 bytes
-rw-r--r--pdf-as-web/src/main/webapp/index.jsp2
4 files changed, 22 insertions, 32 deletions
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 29b7eb21..ee41a8cf 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
@@ -29,6 +29,7 @@ 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;
public class PdfAsParameterExtractor {
@@ -71,7 +72,6 @@ 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_PLACEHOLDERID = "placeholder_id";
@@ -89,8 +89,7 @@ public class PdfAsParameterExtractor {
}
public static String getPlaceholderId(HttpServletRequest request) {
- String placeholderId = (String)request.getAttribute(PARAM_PLACEHOLDERID);
- return placeholderId;
+ return (String)request.getAttribute(IConfigurationConstants.PLACEHOLDER_WEB_ID);
}
public static String getTransactionId(HttpServletRequest request) {
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 07fb7d65..3cea5247 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
@@ -23,28 +23,14 @@
******************************************************************************/
package at.gv.egiz.pdfas.web.servlets;
-import java.io.File;
-import java.io.IOException;
-import java.util.List;
-
-import javax.servlet.ServletException;
-import javax.servlet.http.HttpServlet;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-import org.apache.commons.fileupload.FileItem;
-import org.apache.commons.fileupload.disk.DiskFileItemFactory;
-import org.apache.commons.fileupload.servlet.ServletFileUpload;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
import at.gv.egiz.pdfas.common.exceptions.PDFASError;
import at.gv.egiz.pdfas.common.exceptions.PdfAsException;
-import at.gv.egiz.pdfas.common.exceptions.PdfAsSettingsException;
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;
@@ -57,6 +43,19 @@ import at.gv.egiz.pdfas.web.stats.StatisticEvent.Operation;
import at.gv.egiz.pdfas.web.stats.StatisticEvent.Source;
import at.gv.egiz.pdfas.web.stats.StatisticEvent.Status;
import at.gv.egiz.pdfas.web.stats.StatisticFrontend;
+import org.apache.commons.fileupload.FileItem;
+import org.apache.commons.fileupload.disk.DiskFileItemFactory;
+import org.apache.commons.fileupload.servlet.ServletFileUpload;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.File;
+import java.io.IOException;
+import java.util.List;
/**
* Servlet implementation class Sign
@@ -171,9 +170,6 @@ public class ExternSignServlet extends HttpServlet {
try {
byte[] filecontent = null;
-
-
-
// checks if the request actually contains upload file
if (!ServletFileUpload.isMultipartContent(request)) {
// No Uploaded data!
@@ -185,11 +181,6 @@ public class ExternSignServlet extends HttpServlet {
}
} else {
-
- //takes placeholder id if exist
- //if(request.getParameter("placeholder_id")!=null && !request.getParameter("placeholder_id").isEmpty()){
- // String placeholder_id = request.getParameter("placeholder_id");
- //}
// configures upload settings
DiskFileItemFactory factory = new DiskFileItemFactory();
factory.setSizeThreshold(WebConfiguration.getFilesizeThreshold());
@@ -345,7 +336,9 @@ public class ExternSignServlet extends HttpServlet {
String locale = PdfAsParameterExtractor.getLocale(request);
PdfAsHelper.setLocale(request, response, locale);
+ //read and set placholder web id
String placeholder_id = PdfAsParameterExtractor.getPlaceholderId(request);
+ PlaceholderWebConfiguration.setValue(IConfigurationConstants.PLACEHOLDER_WEB_ID, placeholder_id);
String filename = PdfAsParameterExtractor.getFilename(request);
if(filename != null) {
@@ -416,9 +409,7 @@ public class ExternSignServlet extends HttpServlet {
throw new PdfAsWebException("Invalid connector moa is not supported");
}
}
-
-
-
+
byte[] pdfSignedData = PdfAsHelper.synchornousSignature(request,
response, pdfData);
PdfAsHelper.setSignedPdf(request, response, pdfSignedData);
@@ -434,7 +425,5 @@ public class ExternSignServlet extends HttpServlet {
} else {
throw new PdfAsWebException("Invalid connector (bku | moa | jks)");
}
-
}
-
}
diff --git a/pdf-as-web/src/main/webapp/assets/img/localBKU.png b/pdf-as-web/src/main/webapp/assets/img/localBKU.png
new file mode 100644
index 00000000..2ec41892
--- /dev/null
+++ b/pdf-as-web/src/main/webapp/assets/img/localBKU.png
Binary files differ
diff --git a/pdf-as-web/src/main/webapp/index.jsp b/pdf-as-web/src/main/webapp/index.jsp
index bc20936e..de41028b 100644
--- a/pdf-as-web/src/main/webapp/index.jsp
+++ b/pdf-as-web/src/main/webapp/index.jsp
@@ -32,6 +32,8 @@
%>
<img src="assets/img/mobileBKU.png" />
<button type="submit" value="mobilebku" name="connector" id="mobilebku">Handy</button>
+ <label for="placeholder_web_id">Placeholder ID</label>
+ <input type="text" id="placeholder_web_id" name="placeholder_web_id">
<%
}
%>