From 3552a920be650a0145a6f3111f1fa76699cf88f3 Mon Sep 17 00:00:00 2001 From: rpiazzi Date: Tue, 25 Oct 2011 10:19:37 +0000 Subject: Added filename of the original file within the header git-svn-id: https://joinup.ec.europa.eu/svn/pdf-as/trunk@878 7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c --- .../main/java/at/gv/egiz/pdfas/web/servlets/ProvidePDFServlet.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/servlets/ProvidePDFServlet.java b/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/servlets/ProvidePDFServlet.java index 741c8a6..dced4c9 100644 --- a/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/servlets/ProvidePDFServlet.java +++ b/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/servlets/ProvidePDFServlet.java @@ -112,13 +112,15 @@ public class ProvidePDFServlet extends HttpServlet { SignServletHelper.disableBrowserCacheForResponse(response); response.setContentType("application/pdf"); response.setContentLength(pdf.length); + SignSessionInformation si = (SignSessionInformation)session.getAttribute(SessionAttributes.ATTRIBUTE_SESSION_INFORMATION); + response.setHeader("Content-disposition", "attachment; filename=\""+si.filename+"\""); InputStream is = new ByteArrayInputStream(pdf); final int bufferSize = 1024; byte[] buffer = new byte[bufferSize]; int len = -1; while ((len = is.read(buffer)) != -1) { - response.getOutputStream().write(buffer, 0, len); + response.getOutputStream().write(buffer, 0, len); } response.getOutputStream().flush(); log.debug("File sent. Invalidating session."); -- cgit v1.2.3