aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/main/java/at/gv/egiz/pdfas/web/helper/SignServletHelper.java17
1 files changed, 15 insertions, 2 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 9826500..0c85201 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
@@ -212,11 +212,24 @@ public class SignServletHelper
String pdf_id = String.valueOf(si.exappinf.pdf_id);
String session_id = si.exappinf.session_id;
+ log.debug("External application has to be notified. Building url from callback url \"" + invoke_url + "\".");
+
// 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;
+
+ // fixed by tknall: must not presume that invoke_url contains "?"
+ String sep = "&";
+ if (ind == -1) {
+ ind = invoke_url.length();
+ sep = "?";
+ }
+
+ 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;
+ log.debug("Notifying external application by redirecting to \"" + query + "\".");
+
response.sendRedirect(query);
}