diff OrthancServer/Sources/main.cpp @ 4227:7fff7e683d65

basic implementation of WebDAV handler
author Sebastien Jodogne <s.jodogne@gmail.com>
date Mon, 05 Oct 2020 10:55:24 +0200
parents 7bd5eab3ba25
children c8c0bbaaace3
line wrap: on
line diff
--- a/OrthancServer/Sources/main.cpp	Sun Oct 04 13:23:53 2020 +0200
+++ b/OrthancServer/Sources/main.cpp	Mon Oct 05 10:55:24 2020 +0200
@@ -624,17 +624,23 @@
   {
   }
   
+  virtual bool IsExistingFolder(const std::vector<std::string>& path) ORTHANC_OVERRIDE
+  {
+    return (path.size() == 0 ||
+            (path.size() == 1 && path[0] == "Folder1") ||
+            (path.size() == 2 && path[0] == "Folder1" && path[1] == "Folder2"));
+  }
+
   virtual bool ListCollection(Collection& collection,
                               const UriComponents& path) ORTHANC_OVERRIDE
   {
-    if (path.size() == 0 ||
-        (path.size() == 1 && path[0] == "Folder1") ||
-        (path.size() == 2 && path[0] == "Folder1" && path[1] == "Folder2"))
+    if (IsExistingFolder(path))
     {
       for (unsigned int i = 0; i < 5; i++)
       {
         std::unique_ptr<File> f(new File("IM" + boost::lexical_cast<std::string>(i) + ".dcm"));
         f->SetContentLength(1024 * i);
+        f->SetMimeType(MimeType_PlainText);
         collection.AddResource(f.release());
       }
         
@@ -1106,7 +1112,8 @@
 
     {
       std::vector<std::string> root;  // TODO
-      root.push_back("davfs");
+      root.push_back("a");
+      root.push_back("b");
       httpServer.Register(root, new DummyBucket(context));
     }