diff options
author | knowcenter <knowcenter@7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c> | 2007-09-03 08:18:14 +0000 |
---|---|---|
committer | knowcenter <knowcenter@7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c> | 2007-09-03 08:18:14 +0000 |
commit | adca9aa047ef72850750af958989bd7a8dad2985 (patch) | |
tree | 9e6cfc5e355c973814b57a34e6b4222a0156bfad /src/main/java/at/knowcenter/wag | |
parent | 4fc12d0d87577f95c48b55d15058e41ae2b5d402 (diff) | |
download | pdf-as-3-adca9aa047ef72850750af958989bd7a8dad2985.tar.gz pdf-as-3-adca9aa047ef72850750af958989bd7a8dad2985.tar.bz2 pdf-as-3-adca9aa047ef72850750af958989bd7a8dad2985.zip |
Performance-Logging
git-svn-id: https://joinup.ec.europa.eu/svn/pdf-as/trunk@208 7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c
Diffstat (limited to 'src/main/java/at/knowcenter/wag')
-rw-r--r-- | src/main/java/at/knowcenter/wag/egov/egiz/web/servlets/SignServlet.java | 18 | ||||
-rw-r--r-- | src/main/java/at/knowcenter/wag/egov/egiz/web/servlets/VerifyServlet.java | 41 |
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 |