From 023d1b5d7046b6a3062e90a4628f09a50a876f1b Mon Sep 17 00:00:00 2001 From: Andreas Fitzek Date: Fri, 26 Sep 2014 11:23:56 +0200 Subject: added filename parameter to overwrite default pdf filename --- .../java/at/gv/egiz/pdfas/web/helper/PdfAsParameterExtractor.java | 6 ++++++ .../main/java/at/gv/egiz/pdfas/web/servlets/ExternSignServlet.java | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/helper/PdfAsParameterExtractor.java b/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/helper/PdfAsParameterExtractor.java index 017eabb2..c8f35f3c 100644 --- a/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/helper/PdfAsParameterExtractor.java +++ b/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/helper/PdfAsParameterExtractor.java @@ -61,6 +61,7 @@ public class PdfAsParameterExtractor { public static final String PARAM_SIG_POS_R = "sig-pos-r"; public static final String PARAM_SIG_POS_F = "sig-pos-f"; public static final String PARAM_SIG_IDX = "sig-idx"; + public static final String PARAM_FILENAME = "filename"; public static String getConnector(HttpServletRequest request) { String connector = (String)request.getAttribute(PARAM_CONNECTOR); @@ -75,6 +76,11 @@ public class PdfAsParameterExtractor { return transactionId; } + public static String getFilename(HttpServletRequest request) { + String filename = (String)request.getAttribute(PARAM_FILENAME); + return filename; + } + public static String getInvokeURL(HttpServletRequest request) { return (String)request.getAttribute(PARAM_INVOKE_URL); } diff --git a/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/servlets/ExternSignServlet.java b/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/servlets/ExternSignServlet.java index 121fbc88..ce19f803 100644 --- a/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/servlets/ExternSignServlet.java +++ b/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/servlets/ExternSignServlet.java @@ -261,6 +261,12 @@ public class ExternSignServlet extends HttpServlet { String locale = PdfAsParameterExtractor.getLocale(request); PdfAsHelper.setLocale(request, response, locale); + String filename = PdfAsParameterExtractor.getFilename(request); + if(filename != null) { + logger.debug("Setting Filename in session: " + filename); + PdfAsHelper.setPDFFileName(request, filename); + } + if(pdfData == null) { throw new PdfAsException("No Signature data available"); } -- cgit v1.2.3