diff options
author | Andreas Fitzek <andreas.fitzek@iaik.tugraz.at> | 2014-02-05 10:30:30 +0100 |
---|---|---|
committer | Andreas Fitzek <andreas.fitzek@iaik.tugraz.at> | 2014-02-05 10:30:30 +0100 |
commit | a8183a22b3a5bd9b062a1cded09a75ec8fa3be8e (patch) | |
tree | 5f1ec1ebc6fc343eacd85212efff1655316af250 /pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/servlets | |
parent | fe8409ea3ebbb34058eeb5c2f0a6977b8a421686 (diff) | |
download | pdf-as-4-a8183a22b3a5bd9b062a1cded09a75ec8fa3be8e.tar.gz pdf-as-4-a8183a22b3a5bd9b062a1cded09a75ec8fa3be8e.tar.bz2 pdf-as-4-a8183a22b3a5bd9b062a1cded09a75ec8fa3be8e.zip |
Fixed signature data hash verification, Pdf Download document name
Diffstat (limited to 'pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/servlets')
-rw-r--r-- | pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/servlets/ExternSignServlet.java | 19 | ||||
-rw-r--r-- | pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/servlets/PDFData.java | 1 |
2 files changed, 18 insertions, 2 deletions
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 3a6bc971..dddd80dd 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 @@ -151,7 +151,22 @@ public class ExternSignServlet extends HttpServlet { FileItem item = (FileItem) obj; if(item.getFieldName().equals(UPLOAD_PDF_DATA)) { filecontent = item.get(); - + try { + File f = new File(item.getName()); + String name = f.getName(); + logger.debug("Got upload: " + item.getName()); + if(name != null) { + if(!(name.endsWith(".pdf") || name.endsWith(".PDF"))) { + name += ".pdf"; + } + + logger.debug("Setting Filename in session: " + name); + PdfAsHelper.setPDFFileName(request, name); + } + } + catch(Throwable e) { + logger.error("In resolving filename", e); + } if(filecontent.length < 10) { filecontent = null; } else { @@ -162,7 +177,7 @@ public class ExternSignServlet extends HttpServlet { logger.debug("Setting " + item.getFieldName() + " = " + item.getString()); } } else { - logger.info(obj.getClass().getName() + " - " + obj.toString()); + logger.debug(obj.getClass().getName() + " - " + obj.toString()); } } } diff --git a/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/servlets/PDFData.java b/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/servlets/PDFData.java index 9bf66fe9..0800c05c 100644 --- a/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/servlets/PDFData.java +++ b/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/servlets/PDFData.java @@ -70,6 +70,7 @@ public class PDFData extends HttpServlet { return; } } + response.setHeader("Content-Disposition", "inline;filename=" + PdfAsHelper.getPDFFileName(request)); response.setContentType("application/pdf"); OutputStream os = response.getOutputStream(); os.write(signedData); |