comparison Core/HttpServer/EmbeddedResourceHttpHandler.cpp @ 895:7e8cde5905fd plugins

allow superposition of REST handlers
author Sebastien Jodogne <s.jodogne@gmail.com>
date Mon, 16 Jun 2014 17:47:58 +0200
parents a811bdf8b8eb
children 7d88f3f4a3b3
comparison
equal deleted inserted replaced
894:690aeb4cb899 895:7e8cde5905fd
55 { 55 {
56 return Toolbox::IsChildUri(baseUri_, uri); 56 return Toolbox::IsChildUri(baseUri_, uri);
57 } 57 }
58 58
59 59
60 void EmbeddedResourceHttpHandler::Handle( 60 bool EmbeddedResourceHttpHandler::Handle(
61 HttpOutput& output, 61 HttpOutput& output,
62 HttpMethod method, 62 HttpMethod method,
63 const UriComponents& uri, 63 const UriComponents& uri,
64 const Arguments& headers, 64 const Arguments& headers,
65 const Arguments& arguments, 65 const Arguments& arguments,
66 const std::string&) 66 const std::string&)
67 { 67 {
68 if (method != HttpMethod_Get) 68 if (method != HttpMethod_Get)
69 { 69 {
70 output.SendMethodNotAllowedError("GET"); 70 output.SendMethodNotAllowedError("GET");
71 return; 71 return true;
72 } 72 }
73 73
74 std::string resourcePath = Toolbox::FlattenUri(uri, baseUri_.size()); 74 std::string resourcePath = Toolbox::FlattenUri(uri, baseUri_.size());
75 std::string contentType = Toolbox::AutodetectMimeType(resourcePath); 75 std::string contentType = Toolbox::AutodetectMimeType(resourcePath);
76 76
83 catch (OrthancException&) 83 catch (OrthancException&)
84 { 84 {
85 LOG(WARNING) << "Unable to find HTTP resource: " << resourcePath; 85 LOG(WARNING) << "Unable to find HTTP resource: " << resourcePath;
86 output.SendHeader(HttpStatus_404_NotFound); 86 output.SendHeader(HttpStatus_404_NotFound);
87 } 87 }
88
89 return true;
88 } 90 }
89 } 91 }