aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/knowcenter
diff options
context:
space:
mode:
authortknall <tknall@7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c>2009-12-21 11:28:50 +0000
committertknall <tknall@7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c>2009-12-21 11:28:50 +0000
commit3d88697da5a47139625700e591bef9baada4258a (patch)
tree0310677ede70a8867e72b0b0ba16663c10201482 /src/main/java/at/knowcenter
parent544d191a359434120cf761384d686310a55ef5ca (diff)
downloadpdf-as-3-3d88697da5a47139625700e591bef9baada4258a.tar.gz
pdf-as-3-3d88697da5a47139625700e591bef9baada4258a.tar.bz2
pdf-as-3-3d88697da5a47139625700e591bef9baada4258a.zip
web application: many minor improvements (pdf/a selection for instance)
Adobe signature attribute: added feature allowing configuration of field "reason" configuration updates default configuration updated git-svn-id: https://joinup.ec.europa.eu/svn/pdf-as/trunk@521 7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c
Diffstat (limited to 'src/main/java/at/knowcenter')
-rw-r--r--src/main/java/at/knowcenter/wag/egov/egiz/PdfAS.java5
-rw-r--r--src/main/java/at/knowcenter/wag/egov/egiz/pdf/AdobeSignatureHelper.java15
-rw-r--r--src/main/java/at/knowcenter/wag/egov/egiz/tools/CodingHelper.java1
-rw-r--r--src/main/java/at/knowcenter/wag/egov/egiz/web/FormFields.java3
-rw-r--r--src/main/java/at/knowcenter/wag/egov/egiz/web/PdfASServletContextListener.java7
-rw-r--r--src/main/java/at/knowcenter/wag/egov/egiz/web/servlets/SignServlet.java4
-rw-r--r--src/main/java/at/knowcenter/wag/egov/egiz/web/servlets/UpdateFormServlet.java7
7 files changed, 32 insertions, 10 deletions
diff --git a/src/main/java/at/knowcenter/wag/egov/egiz/PdfAS.java b/src/main/java/at/knowcenter/wag/egov/egiz/PdfAS.java
index 43f7f14..78e4eec 100644
--- a/src/main/java/at/knowcenter/wag/egov/egiz/PdfAS.java
+++ b/src/main/java/at/knowcenter/wag/egov/egiz/PdfAS.java
@@ -25,13 +25,10 @@ import java.util.Comparator;
import java.util.Date;
import java.util.List;
import java.util.Vector;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import at.gv.egiz.pdfas.algorithmSuite.AlgorithmSuiteUtil;
import at.gv.egiz.pdfas.api.analyze.NonTextObjectInfo;
import at.gv.egiz.pdfas.api.timestamp.TimeStamper;
import at.gv.egiz.pdfas.commandline.CommandlineConnectorChooser;
@@ -102,7 +99,7 @@ public abstract class PdfAS
* The current version of the pdf-as library. This version string is logged on every invocation
* of the api or the web application.
*/
- public static final String PDFAS_VERSION = "3.1-snapshot";
+ public static final String PDFAS_VERSION = "3.1-snapshot (20091221)";
/**
* The key of the strict mode setting.
diff --git a/src/main/java/at/knowcenter/wag/egov/egiz/pdf/AdobeSignatureHelper.java b/src/main/java/at/knowcenter/wag/egov/egiz/pdf/AdobeSignatureHelper.java
index 9a52a84..1ce0b6f 100644
--- a/src/main/java/at/knowcenter/wag/egov/egiz/pdf/AdobeSignatureHelper.java
+++ b/src/main/java/at/knowcenter/wag/egov/egiz/pdf/AdobeSignatureHelper.java
@@ -6,6 +6,7 @@ import java.util.Iterator;
import javax.xml.datatype.DatatypeFactory;
import javax.xml.datatype.XMLGregorianCalendar;
+import org.apache.commons.lang.StringUtils;
import org.apache.log4j.Logger;
import at.gv.egiz.pdfas.api.commons.Constants;
@@ -36,6 +37,8 @@ import com.lowagie.text.pdf.PdfString;
*/
public class AdobeSignatureHelper {
private static final String ADOBE_SIGN_FIELDNAME_KEY = "adobeSignFieldValue";
+
+ private static final String ADOBE_SIGN_REASONNAME_KEY = "adobeSignReasonValue";
private static final String ADOBE_SIG_ENABLED_KEY = "adobeSignEnabled";
@@ -112,6 +115,12 @@ public class AdobeSignatureHelper {
// sig.setContact("contact is not visible");
// sig.setDate(new PdfDate());
+ String reason = getAdobeReasonName(so.getSignatureTypeDefinition().getType());
+ if (!StringUtils.isEmpty(reason)) {
+ sig.setReason(reason);
+ }
+
+
/* disabled in order to align adobe signature appearance for textual signatures with binary signatures
if (si != null) {
XMLGregorianCalendar c = DatatypeFactory.newInstance().newXMLGregorianCalendar(
@@ -155,7 +164,11 @@ public class AdobeSignatureHelper {
}
private static String getAdobeFieldName(String sigProfile) {
- return getDefaultableConfigProperty(sigProfile, ADOBE_SIGN_FIELDNAME_KEY, "PDF-AS-Signatur");
+ return getDefaultableConfigProperty(sigProfile, ADOBE_SIGN_FIELDNAME_KEY, "PDF-AS Signatur");
+ }
+
+ private static String getAdobeReasonName(String sigProfile) {
+ return getDefaultableConfigProperty(sigProfile, ADOBE_SIGN_REASONNAME_KEY, null);
}
private static String getDefaultableConfigProperty(String sigProfile, String propName, String defaultValue) {
diff --git a/src/main/java/at/knowcenter/wag/egov/egiz/tools/CodingHelper.java b/src/main/java/at/knowcenter/wag/egov/egiz/tools/CodingHelper.java
index ce46e68..8d05960 100644
--- a/src/main/java/at/knowcenter/wag/egov/egiz/tools/CodingHelper.java
+++ b/src/main/java/at/knowcenter/wag/egov/egiz/tools/CodingHelper.java
@@ -218,6 +218,7 @@ public class CodingHelper
}
catch (NoSuchAlgorithmException e)
{
+ e.printStackTrace();
return null;
}
}
diff --git a/src/main/java/at/knowcenter/wag/egov/egiz/web/FormFields.java b/src/main/java/at/knowcenter/wag/egov/egiz/web/FormFields.java
index 7137741..d455179 100644
--- a/src/main/java/at/knowcenter/wag/egov/egiz/web/FormFields.java
+++ b/src/main/java/at/knowcenter/wag/egov/egiz/web/FormFields.java
@@ -54,6 +54,9 @@ public abstract class FormFields
public static final String FIELD_RAW_DOCUMENT_TEXT = "raw_document_text";
public static final String FIELD_SIGNATURE_TYPE = "sig_type";
+
+ // tknall: PDF/A-1b enabled
+ public static final String FIELD_PDFA_ENABLED = "pdfa_enabled";
public static final String FIELD_VERIFY_WHICH = "verify_which";
diff --git a/src/main/java/at/knowcenter/wag/egov/egiz/web/PdfASServletContextListener.java b/src/main/java/at/knowcenter/wag/egov/egiz/web/PdfASServletContextListener.java
index cdd3df1..32cfc1e 100644
--- a/src/main/java/at/knowcenter/wag/egov/egiz/web/PdfASServletContextListener.java
+++ b/src/main/java/at/knowcenter/wag/egov/egiz/web/PdfASServletContextListener.java
@@ -20,6 +20,7 @@ package at.knowcenter.wag.egov.egiz.web;
import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;
+import org.apache.commons.lang.StringUtils;
import org.apache.log4j.Logger;
import at.gv.egiz.pdfas.api.commons.Constants;
@@ -65,19 +66,19 @@ public class PdfASServletContextListener implements ServletContextListener
String work_dir;
// search for system property
- if (sysPropWorkdir != null && sysPropWorkdir.length() > 0) {
+ if (!StringUtils.isEmpty(sysPropWorkdir)) {
work_dir = sysPropWorkdir;
logger.debug("Work-dir configuration via system property \"" + Constants.CONFIG_DIR_SYSTEM_PROPERTY + "\" = \"" + sysPropWorkdir + "\".");
// search for servlet parameter
- } else if (scWorkdir != null && scWorkdir.length() > 0){
+ } else if (!StringUtils.isEmpty(scWorkdir)){
work_dir = scWorkdir;
logger.debug("Work-dir configuration via servlet init parameter \"" + CONFIG_SERVLET_INIT_PARAMETER + "\" = \"" + scWorkdir + "\".");
// assume configuration to be located in webapp path
} else {
work_dir = sce.getServletContext().getRealPath("/");
- logger.debug("PDF-AS work-dir not explicitely given. Assuming configuration is located in webapp folder \"" + work_dir + "\".");
+ logger.info("PDF-AS work-dir not explicitely given. Assuming configuration is located in webapp folder \"" + work_dir + "\".");
}
logger.info("PDF-AS configuration location = \"" + work_dir + "\"");
diff --git a/src/main/java/at/knowcenter/wag/egov/egiz/web/servlets/SignServlet.java b/src/main/java/at/knowcenter/wag/egov/egiz/web/servlets/SignServlet.java
index 792a3e1..f30f0fb 100644
--- a/src/main/java/at/knowcenter/wag/egov/egiz/web/servlets/SignServlet.java
+++ b/src/main/java/at/knowcenter/wag/egov/egiz/web/servlets/SignServlet.java
@@ -395,6 +395,10 @@ public class SignServlet extends HttpServlet
download_fi = item;
continue;
}
+
+ if (FormFields.FIELD_PDFA_ENABLED.equals(item.getFieldName())) {
+ continue;
+ }
throw new ServletException("unrecognized POST data."); //$NON-NLS-1$
diff --git a/src/main/java/at/knowcenter/wag/egov/egiz/web/servlets/UpdateFormServlet.java b/src/main/java/at/knowcenter/wag/egov/egiz/web/servlets/UpdateFormServlet.java
index ba5d43e..2d21545 100644
--- a/src/main/java/at/knowcenter/wag/egov/egiz/web/servlets/UpdateFormServlet.java
+++ b/src/main/java/at/knowcenter/wag/egov/egiz/web/servlets/UpdateFormServlet.java
@@ -18,20 +18,23 @@ public class UpdateFormServlet extends HttpServlet {
public static final String UPLOADFORM_SIGNATURE_TYPE_KEY = "signupload.jsp:signatureType";
public static final String UPLOADFORM_SIGNATURE_MODE_KEY = "signupload.jsp:signatureMode";
public static final String UPLOADFORM_SIGNATURE_DEVICE_KEY = "signupload.jsp:signatureKey";
+ public static final String UPLOADFORM_PDFA_KEY = "signupload.jsp:pdfaKey";
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
this.doPost(request, response);
}
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
- String mode = request.getParameter(FormFields.FIELD_MODE);
+ String mode = request.getParameter(FormFields.FIELD_MODE);
String device = request.getParameter(FormFields.FIELD_CONNECTOR);
- String type = request.getParameter(FormFields.FIELD_SIGNATURE_TYPE);
+ String type = request.getParameter(FormFields.FIELD_SIGNATURE_TYPE);
+ String pdfa = request.getParameter(FormFields.FIELD_PDFA_ENABLED);
HttpSession session = request.getSession();
session.setAttribute(UPLOADFORM_SIGNATURE_DEVICE_KEY, device);
session.setAttribute(UPLOADFORM_SIGNATURE_MODE_KEY, mode);
session.setAttribute(UPLOADFORM_SIGNATURE_TYPE_KEY, type);
+ session.setAttribute(UPLOADFORM_PDFA_KEY, pdfa);
RequestDispatcher dispatcher = request.getRequestDispatcher("/jsp/signupload.jsp");
dispatcher.forward(request, response);