comparison Core/HttpServer/EmbeddedResourceHttpHandler.cpp @ 2908:9d277f8ad698

new enumeration: MimeType
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 30 Oct 2018 16:16:07 +0100
parents 2a504fef4ed7
children 4e43e67f8ecf
comparison
equal deleted inserted replaced
2907:0204af4ece6a 2908:9d277f8ad698
76 output.SendMethodNotAllowed("GET"); 76 output.SendMethodNotAllowed("GET");
77 return true; 77 return true;
78 } 78 }
79 79
80 std::string resourcePath = Toolbox::FlattenUri(uri, baseUri_.size()); 80 std::string resourcePath = Toolbox::FlattenUri(uri, baseUri_.size());
81 std::string contentType = SystemToolbox::AutodetectMimeType(resourcePath); 81 MimeType contentType = SystemToolbox::AutodetectMimeType(resourcePath);
82 82
83 try 83 try
84 { 84 {
85 const void* buffer = EmbeddedResources::GetDirectoryResourceBuffer(resourceId_, resourcePath.c_str()); 85 const void* buffer = EmbeddedResources::GetDirectoryResourceBuffer(resourceId_, resourcePath.c_str());
86 size_t size = EmbeddedResources::GetDirectoryResourceSize(resourceId_, resourcePath.c_str()); 86 size_t size = EmbeddedResources::GetDirectoryResourceSize(resourceId_, resourcePath.c_str());
87 87
88 output.SetContentType(contentType.c_str()); 88 output.SetContentType(contentType);
89 output.Answer(buffer, size); 89 output.Answer(buffer, size);
90 } 90 }
91 catch (OrthancException&) 91 catch (OrthancException&)
92 { 92 {
93 LOG(WARNING) << "Unable to find HTTP resource: " << resourcePath; 93 LOG(WARNING) << "Unable to find HTTP resource: " << resourcePath;