]> source.dussan.org Git - vaadin-framework.git/commitdiff
fixes #1589, default value for Content-Disposition http header
authorMatti Tahvonen <matti.tahvonen@itmill.com>
Tue, 23 Sep 2008 07:28:41 +0000 (07:28 +0000)
committerMatti Tahvonen <matti.tahvonen@itmill.com>
Tue, 23 Sep 2008 07:28:41 +0000 (07:28 +0000)
svn changeset:5481/svn branch:trunk

src/com/itmill/toolkit/terminal/gwt/server/ApplicationServlet.java

index c4471ac11e603160c449dae534a56d6d78311484..30fd38ca734e0d153a0f92a3a08b9661b0c57afb 100644 (file)
@@ -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;