aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/knowcenter/wag
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/at/knowcenter/wag')
-rw-r--r--src/main/java/at/knowcenter/wag/egov/egiz/web/servlets/SignServlet.java18
-rw-r--r--src/main/java/at/knowcenter/wag/egov/egiz/web/servlets/VerifyServlet.java41
2 files changed, 59 insertions, 0 deletions
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 0ebe3ea..60b3431 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
@@ -161,6 +161,15 @@ public class SignServlet extends HttpServlet
UploadedData ud = null;
ExternAppInformation exappinf = null;
TablePos pos = null;
+
+ // for performance measurement
+ long startTime = 0;
+ long fileSize = 0;
+ if (log.isInfoEnabled()) {
+ startTime = System.currentTimeMillis();
+ }
+
+
// check if pdf-as has been called by external webapp
if (request.getParameter(FormFields.FIELD_PDF_URL) != null)
@@ -277,6 +286,15 @@ public class SignServlet extends HttpServlet
}
SignServletHelper.finishSign(si, request, response, getServletContext());
+
+ // for performance measurement
+ if (log.isInfoEnabled()) {
+ long endTime = System.currentTimeMillis();
+ String toReport = "SIGN;" + si.mode + ";" + si.filename + ";"+ fileSize + ";" +
+ (endTime - startTime);
+
+ log.info(toReport);
+ }
}
catch (PresentableException e)
{
diff --git a/src/main/java/at/knowcenter/wag/egov/egiz/web/servlets/VerifyServlet.java b/src/main/java/at/knowcenter/wag/egov/egiz/web/servlets/VerifyServlet.java
index 38f3e64..dc52187 100644
--- a/src/main/java/at/knowcenter/wag/egov/egiz/web/servlets/VerifyServlet.java
+++ b/src/main/java/at/knowcenter/wag/egov/egiz/web/servlets/VerifyServlet.java
@@ -48,7 +48,9 @@ import at.knowcenter.wag.egov.egiz.PdfAS;
import at.knowcenter.wag.egov.egiz.cfg.SettingsReader;
import at.knowcenter.wag.egov.egiz.exceptions.PDFDocumentException;
import at.knowcenter.wag.egov.egiz.exceptions.PresentableException;
+import at.knowcenter.wag.egov.egiz.exceptions.SettingNotFoundException;
import at.knowcenter.wag.egov.egiz.sig.ConnectorFactory;
+import at.knowcenter.wag.egov.egiz.sig.SignatureResponse;
import at.knowcenter.wag.egov.egiz.web.FormFields;
import at.knowcenter.wag.egov.egiz.web.LocalRequestHelper;
import at.knowcenter.wag.egov.egiz.web.SessionAttributes;
@@ -97,6 +99,12 @@ public class VerifyServlet extends HttpServlet
*/
public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
{
+ // for performance measurement
+ long startTime = 0;
+ long fileSize = 0;
+ if (log.isInfoEnabled()) {
+ startTime = System.currentTimeMillis();
+ }
try
{
UploadedData ud = retrieveUploadedDataFromRequest(request);
@@ -137,11 +145,20 @@ public class VerifyServlet extends HttpServlet
}
String host = request.getServerName();
+ // TODO still required for old communication with MOA-SS/SP
URL loc_ref_URL = new URL(request.getScheme(), host, request.getServerPort(), request.getContextPath() + "/RetrieveSignatureData");
String loc_ref_url = response.encodeURL(loc_ref_URL.toString());
List results = PdfAS.verifySignatureHoldersWeb(signature_holders, si, loc_ref_url);
dispatchToResults(results, request, response);
+
+ // for performance measurement
+ if (log.isInfoEnabled()) {
+ long endTime = System.currentTimeMillis();
+ String toReport = "VERIFY;"+ ud.file_name + ";"+ 0 + ";" + (endTime - startTime) + ";" + debugVerifyResults(results);
+ log.info(toReport);
+ }
+
}
}
@@ -390,4 +407,28 @@ public class VerifyServlet extends HttpServlet
protected DataSource dataSource = null;
// protected byte[] file_data = null;
}
+
+ /**
+ * Formats the verification results for debugging. Returns 0 if no error occurs or the sum of all error-codes.
+ *
+ * @param results
+ *
+ * @param writer
+ * The output sink to write the formatted text to.
+ * @throws SettingNotFoundException
+ * Forwarded exception.
+ */
+ protected static int debugVerifyResults(List results) throws SettingNotFoundException
+ {
+ int toreturn = 0;
+ Iterator it = results.iterator();
+ while (it.hasNext())
+ {
+ SignatureResponse result = (SignatureResponse) it.next();
+
+ toreturn += Integer.valueOf(result.getSignatureCheckCode()).intValue();
+ }
+ return toreturn;
+ }
+
} \ No newline at end of file