aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/gv/egiz/pdfas/web/helper/SignServletHelper.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/at/gv/egiz/pdfas/web/helper/SignServletHelper.java')
-rw-r--r--src/main/java/at/gv/egiz/pdfas/web/helper/SignServletHelper.java23
1 files changed, 18 insertions, 5 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 113169c..1e1864b 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
@@ -219,6 +219,7 @@ public class SignServletHelper
ByteArrayDataSink bads = (ByteArrayDataSink)si.output;
signed_pdf = bads.getByteArray();
}
+ HttpSession session = request.getSession();
PDFContainer entry = new PDFContainer(signed_pdf, si.exappinf.pdf_id);
ProvidePDFServlet.signedDocuments.add(entry);
@@ -244,23 +245,28 @@ public class SignServletHelper
String query = invoke_url.substring(0, ind) + ";jsessionid=" + session_id + invoke_url.substring(ind)
+ sep + FormFields.FIELD_PDF_URL + "=" + providePDFServlet + "&" + FormFields.FIELD_PDF_ID
- + "=" + pdf_id + "&" + FormFields.FIELD_FILE_LENGTH + "=" + signed_pdf.length;
+ + "=" + pdf_id + "&" + FormFields.FIELD_FILE_LENGTH + "=" + signed_pdf.length
+ + "&" + FormFields.FIELD_PDFAS_SESSION_ID + "=" + session.getId();
/*
* Using the external web-interface of pdf-as (as described above) pdf-as should be run within
* an iframe. In case of a signature performed with a local citizen card software or with the
- * server bku the result has to be provided outside an iframe. To break out of the iframe a
+ * server bku the result has to be provided outside the iframe. To break out of the iframe a
* helper jsp (redirect_to_parent) has to be used that redirects the user to the parent
* window.
*/
+ disableBrowserCacheForResponse(response);
if (Constants.SIGNATURE_DEVICE_BKU.equals(si.connector) || Constants.SIGNATURE_DEVICE_MOC.equals(si.connector)) {
- HttpSession session = request.getSession();
- log.debug("Local bku was used therefore pdf-as is supposed to run within an iframe.");
+ log.debug("Pdf-as is supposed to run within an iframe.");
log.debug("Putting external application notify url (\"" + query + "\") in session (" + session.getId() + ") for later use.");
- request.getSession().setAttribute(SessionAttributes.PARENT_WEBAPP_REDIRECT_URL, query);
+ session.setAttribute(SessionAttributes.PARENT_WEBAPP_REDIRECT_URL, query);
String redirectHelper = response.encodeRedirectURL(request.getContextPath() + "/jsp/redirect_to_parent.jsp");
+
log.debug("Redirecting to " + redirectHelper);
+ log.debug("The browser will finally be redirected outside the iframe to " + query + " in order to notify the external application.");
+
response.sendRedirect(redirectHelper);
+
} else {
log.debug("Notifying external application by redirecting to \"" + query + "\".");
response.sendRedirect(query);
@@ -270,6 +276,13 @@ public class SignServletHelper
}
+ public static void disableBrowserCacheForResponse(HttpServletResponse response) {
+ log.debug("Disabling browser cache for HttpServletResponse.");
+ response.setHeader("Cache-Control", "no-cache");
+ response.setHeader("Pragma","no-cache");
+ response.setDateHeader("Expires", -1);
+ }
+
/**
* Formats the file name according to the SignResult.
*