aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/gv
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/at/gv')
-rw-r--r--src/main/java/at/gv/egiz/pdfas/web/helper/SignServletHelper.java43
1 files changed, 24 insertions, 19 deletions
diff --git a/src/main/java/at/gv/egiz/pdfas/web/helper/SignServletHelper.java b/src/main/java/at/gv/egiz/pdfas/web/helper/SignServletHelper.java
index 55e0051..cb30809 100644
--- a/src/main/java/at/gv/egiz/pdfas/web/helper/SignServletHelper.java
+++ b/src/main/java/at/gv/egiz/pdfas/web/helper/SignServletHelper.java
@@ -3,6 +3,7 @@
*/
package at.gv.egiz.pdfas.web.helper;
+import java.io.FileInputStream;
import java.io.IOException;
import java.net.URL;
@@ -20,6 +21,7 @@ import at.gv.egiz.pdfas.framework.signator.Signator;
import at.gv.egiz.pdfas.web.SignSessionInformation;
import at.knowcenter.wag.egov.egiz.PdfASID;
import at.knowcenter.wag.egov.egiz.exceptions.PresentableException;
+import at.knowcenter.wag.egov.egiz.framework.SignResult;
import at.knowcenter.wag.egov.egiz.framework.signators.DetachedSignator_1_0_0;
import at.knowcenter.wag.egov.egiz.sig.ConnectorFactory;
import at.knowcenter.wag.egov.egiz.sig.connectors.Connector;
@@ -27,6 +29,8 @@ import at.knowcenter.wag.egov.egiz.sig.connectors.ConnectorChooser;
import at.knowcenter.wag.egov.egiz.sig.connectors.bku.SignSignatureObject;
import at.knowcenter.wag.egov.egiz.web.FormFields;
import at.knowcenter.wag.egov.egiz.web.LocalRequestHelper;
+import at.knowcenter.wag.egov.egiz.web.PDFContainer;
+import at.knowcenter.wag.egov.egiz.web.servlets.ProvidePDFServlet;
/**
* @author wprinz
@@ -179,25 +183,26 @@ public class SignServletHelper
else
{
// TODO @tzefferer: what is this code?
- throw new RuntimeException("This has to be refactored.");
-// SignResult sr = si.sign_result;
-// byte[] signed_pdf = sr.getData();
-// PDFContainer entry = new PDFContainer(signed_pdf, si.exappinf.pdf_id);
-// ProvidePDFServlet.signedDocuments.add(entry);
-//
-// // notify webapp...
-// String invoke_url = si.exappinf.invoke_url;
-//
-// String providePDFServlet = "ProvidePDF";
-// String pdf_id = String.valueOf(si.exappinf.pdf_id);
-// String session_id = si.exappinf.session_id;
-//
-// // build URL
-// int ind = invoke_url.indexOf("?");
-// String query = invoke_url.substring(0, ind) + ";jsessionid=" + session_id + invoke_url.substring(ind) + "&" + FormFields.FIELD_PDF_URL + "=" + providePDFServlet + "&" + FormFields.FIELD_PDF_ID
-// + "=" + pdf_id + "&" + FormFields.FIELD_FILE_LENGTH + "=" + signed_pdf.length;
-//
-// response.sendRedirect(query);
+ byte[] signed_pdf = new byte [(int)si.output.getFile().length()];
+ FileInputStream fis = new FileInputStream(si.output.getFile());
+ fis.read(signed_pdf);
+ fis.close();
+ PDFContainer entry = new PDFContainer(signed_pdf, si.exappinf.pdf_id);
+ ProvidePDFServlet.signedDocuments.add(entry);
+
+ // notify webapp...
+ String invoke_url = si.exappinf.invoke_url;
+
+ String providePDFServlet = "ProvidePDF";
+ String pdf_id = String.valueOf(si.exappinf.pdf_id);
+ String session_id = si.exappinf.session_id;
+
+ // build URL
+ int ind = invoke_url.indexOf("?");
+ String query = invoke_url.substring(0, ind) + ";jsessionid=" + session_id + invoke_url.substring(ind) + "&" + FormFields.FIELD_PDF_URL + "=" + providePDFServlet + "&" + FormFields.FIELD_PDF_ID
+ + "=" + pdf_id + "&" + FormFields.FIELD_FILE_LENGTH + "=" + signed_pdf.length;
+
+ response.sendRedirect(query);
}