diff Core/HttpServer/HttpOutput.h @ 155:93e1b0e3b83a

filenames when downloading json/dicom
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 23 Oct 2012 15:43:46 +0200
parents fe180eae201d
children 7f74209ea0f8
line wrap: on
line diff
--- a/Core/HttpServer/HttpOutput.h	Tue Oct 23 15:12:40 2012 +0200
+++ b/Core/HttpServer/HttpOutput.h	Tue Oct 23 15:43:46 2012 +0200
@@ -46,7 +46,8 @@
 
     void SendOkHeader(const char* contentType,
                       bool hasContentLength,
-                      uint64_t contentLength);
+                      uint64_t contentLength,
+                      const char* contentFilename);
 
   public:
     virtual ~HttpOutput()
@@ -55,16 +56,9 @@
 
     virtual void Send(const void* buffer, size_t length) = 0;
 
-    void SendString(const std::string& s);
-
-    void SendOkHeader();
-
-    void SendOkHeader(uint64_t contentLength);
-
     void SendOkHeader(const std::string& contentType);
 
-    void SendOkHeader(const std::string& contentType,
-                      uint64_t contentLength);
+    void SendString(const std::string& s);
 
     void SendMethodNotAllowedError(const std::string& allowed);
 
@@ -73,11 +67,6 @@
 
     // Higher-level constructs to send entire files or buffers -------------------
 
-    void AnswerBuffer(const std::string& buffer)
-    {
-      AnswerBufferWithContentType(buffer, "");
-    }
-
     void AnswerBufferWithContentType(const std::string& buffer,
                                      const std::string& contentType);
 
@@ -85,25 +74,17 @@
                                      size_t size,
                                      const std::string& contentType);
 
-    void AnswerFile(const std::string& path)
-    {
-      AnswerFileWithContentType(path, "");
-    }
-
     void AnswerFileWithContentType(const std::string& path,
-                                   const std::string& contentType);
+                                   const std::string& contentType,
+                                   const char* filename = NULL);
 
-    void AnswerFileAutodetectContentType(const std::string& path); 
-
-    void AnswerFile(const FileStorage& storage,
-                    const std::string& uuid)
-    {
-      AnswerFile(storage, uuid, "");
-    }
+    void AnswerFileAutodetectContentType(const std::string& path,
+                                         const char* filename = NULL); 
 
     void AnswerFile(const FileStorage& storage,
                     const std::string& uuid,
-                    const std::string& contentType);
+                    const std::string& contentType,
+                    const char* filename = NULL);
 
     void Redirect(const std::string& path);
   };