From ca57797468b5c9d250ab1779e8c74c8e825f46ff Mon Sep 17 00:00:00 2001 From: Matti Tahvonen Date: Tue, 23 Sep 2008 07:28:41 +0000 Subject: [PATCH] fixes #1589, default value for Content-Disposition http header svn changeset:5481/svn branch:trunk --- .../terminal/gwt/server/ApplicationServlet.java | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/com/itmill/toolkit/terminal/gwt/server/ApplicationServlet.java b/src/com/itmill/toolkit/terminal/gwt/server/ApplicationServlet.java index c4471ac11e..30fd38ca73 100644 --- a/src/com/itmill/toolkit/terminal/gwt/server/ApplicationServlet.java +++ b/src/com/itmill/toolkit/terminal/gwt/server/ApplicationServlet.java @@ -1103,6 +1103,17 @@ public class ApplicationServlet extends HttpServlet { } } + // suggest local filename from DownloadStream if Content-Disposition + // not explicitly set + String contentDispositionValue = stream + .getParameter("Content-Disposition"); + if (contentDispositionValue == null) { + contentDispositionValue = "filename=\"" + stream.getFileName() + + "\""; + response.setHeader("Content-Disposition", + contentDispositionValue); + } + int bufferSize = stream.getBufferSize(); if (bufferSize <= 0 || bufferSize > MAX_BUFFER_SIZE) { bufferSize = DEFAULT_BUFFER_SIZE; -- 2.39.5