From 6f8f9f801c56e1c1b743db514ff22ce75157a71b Mon Sep 17 00:00:00 2001 From: tknall Date: Sun, 16 Sep 2007 21:45:10 +0000 Subject: fixed bug concerning compilation of callback url for external application git-svn-id: https://joinup.ec.europa.eu/svn/pdf-as/trunk@213 7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c --- .../at/gv/egiz/pdfas/web/helper/SignServletHelper.java | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) (limited to 'src/main/java/at') 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); } -- cgit v1.2.3