diff options
author | tknall <tknall@7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c> | 2009-03-19 17:33:16 +0000 |
---|---|---|
committer | tknall <tknall@7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c> | 2009-03-19 17:33:16 +0000 |
commit | 5812d840b420697b6821080a7cbb0f3c792fc1ac (patch) | |
tree | ad121e81334e77787798ed4d163d6988a8528513 /src/main/java/at/knowcenter/wag/egov/egiz/web | |
parent | bb883b6f93c08ef276ec30ad383b6ad0f12bf4a8 (diff) | |
download | pdf-as-3-5812d840b420697b6821080a7cbb0f3c792fc1ac.tar.gz pdf-as-3-5812d840b420697b6821080a7cbb0f3c792fc1ac.tar.bz2 pdf-as-3-5812d840b420697b6821080a7cbb0f3c792fc1ac.zip |
Build script for command line version updated.
JavaDoc fixes.
Some updates for debugging messages.
Parser for MOCCA-CreateXMLSignatureResponses enhanced.
Many updates and fixes for the external web app interface.
New profile for invisible signatures added.
git-svn-id: https://joinup.ec.europa.eu/svn/pdf-as/trunk@333 7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c
Diffstat (limited to 'src/main/java/at/knowcenter/wag/egov/egiz/web')
3 files changed, 43 insertions, 23 deletions
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 7b8164a..7137741 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 @@ -85,6 +85,8 @@ public abstract class FormFields public static final String FIELD_PDF_ID = "pdf-id";
+ public static final String FIELD_PDFAS_SESSION_ID = "pdfas-session-id";
+
public static final String FIELD_FILE_LENGTH = "num-bytes";
public static final String FIELD_INVOKE_APP_URL = "invoke-app-url";
diff --git a/src/main/java/at/knowcenter/wag/egov/egiz/web/servlets/DataURLServlet.java b/src/main/java/at/knowcenter/wag/egov/egiz/web/servlets/DataURLServlet.java index f74bd1c..7947d90 100644 --- a/src/main/java/at/knowcenter/wag/egov/egiz/web/servlets/DataURLServlet.java +++ b/src/main/java/at/knowcenter/wag/egov/egiz/web/servlets/DataURLServlet.java @@ -210,6 +210,12 @@ public class DataURLServlet extends HttpServlet log.debug("There are still requests to be performed -> answering with request."); //$NON-NLS-1$
+ // TODO[tknall] Parse user agent's cce type and version in order to prevent unsupported cces from signing pdfs
+ // http://www.buergerkarte.at/konzept/securitylayer/spezifikation/aktuell/bindings/bindings.html#http.kodierung.response.dataurl
+ log.debug("BKU response header \"user-agent\" header: " + request.getHeader("User-Agent"));
+ // http://www.buergerkarte.at/konzept/securitylayer/spezifikation/aktuell/bindings/bindings.html#http.kodierung.response.browser
+ log.debug("BKU response header \"server\" header: " + request.getHeader("Server"));
+
LocalRequest local_request = si.localRequest;
String request_string = local_request.getRequestString();
diff --git a/src/main/java/at/knowcenter/wag/egov/egiz/web/servlets/ProvidePDFServlet.java b/src/main/java/at/knowcenter/wag/egov/egiz/web/servlets/ProvidePDFServlet.java index c40f3c6..803dc59 100644 --- a/src/main/java/at/knowcenter/wag/egov/egiz/web/servlets/ProvidePDFServlet.java +++ b/src/main/java/at/knowcenter/wag/egov/egiz/web/servlets/ProvidePDFServlet.java @@ -42,9 +42,9 @@ public class ProvidePDFServlet extends HttpServlet { public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
String pdfIdString = request.getParameter(FormFields.FIELD_PDF_ID);
+ HttpSession session = request.getSession();
if (pdfIdString == null) {
- HttpSession session = request.getSession(true);
log.debug("No " + FormFields.FIELD_PDF_ID + " provided. Trying to retrieve PDF from session (" + session.getId() + ").");
SignSessionInformation si = (SignSessionInformation) session.getAttribute(SessionAttributes.SIGNED_PDF_DOCUMENT);
if (si == null) {
@@ -59,39 +59,51 @@ public class ProvidePDFServlet extends HttpServlet { log.debug("Signed pdf found.");
session.removeAttribute(SessionAttributes.SIGNED_PDF_DOCUMENT);
log.debug("Returning signed pdf to browser.");
-// log.debug("Invalidating session.");
-// session.invalidate();
SignServletHelper.returnSignResponse(si, request, response);
return;
}
} else {
long pdfId = Long.parseLong(pdfIdString);
- Iterator it = signedDocuments.iterator();
+ byte[] pdf = null;
+
+ synchronized (signedDocuments) {
+ Iterator it = signedDocuments.iterator();
- while (it.hasNext()) {
- PDFContainer current = (PDFContainer) it.next();
- if (current.id == pdfId) {
- try {
- byte[] pdf = current.pdf;
-
- response.setContentType("application/pdf");
- response.setContentLength(pdf.length);
-
- InputStream is = new ByteArrayInputStream(pdf);
- final int bufferSize = 1024;
- byte[] buffer = new byte[bufferSize];
- int len = -1;
- while ((len = is.read(buffer)) != -1) {
- response.getOutputStream().write(buffer, 0, len);
- }
- response.getOutputStream().flush();
+ while (it.hasNext() && pdf == null) {
+ PDFContainer current = (PDFContainer) it.next();
+ if (current.id == pdfId) {
+ pdf = current.pdf;
signedDocuments.remove(current);
- } catch (IOException e) {
- log.error("IO excepton while providing pdf document: " + e.getMessage(), e);
}
}
}
+
+ if (pdf != null) {
+ try {
+
+ SignServletHelper.disableBrowserCacheForResponse(response);
+ response.setContentType("application/pdf");
+ response.setContentLength(pdf.length);
+
+ InputStream is = new ByteArrayInputStream(pdf);
+ final int bufferSize = 1024;
+ byte[] buffer = new byte[bufferSize];
+ int len = -1;
+ while ((len = is.read(buffer)) != -1) {
+ response.getOutputStream().write(buffer, 0, len);
+ }
+ response.getOutputStream().flush();
+ log.debug("File sent. Invalidating session.");
+ session.invalidate();
+ } catch (IOException e) {
+ log.error("IO excepton while providing pdf document: " + e.getMessage(), e);
+ }
+ } else {
+ log.error("Unable to find signed pdf (id=" + pdfId + ") in session (" + session.getId() + ").");
+ return;
+ }
+
}
}
|