comparison OrthancServer/OrthancRestApi/OrthancRestSystem.cpp @ 1023:226cfef3822e templating

integration mainline->templating
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 10 Jul 2014 11:42:32 +0200
parents cf52f3bcb2b3
children 01414536c930
comparison
equal deleted inserted replaced
945:427a1f996b7b 1023:226cfef3822e
41 41
42 namespace Orthanc 42 namespace Orthanc
43 { 43 {
44 // System information ------------------------------------------------------- 44 // System information -------------------------------------------------------
45 45
46 static void ServeRoot(RestApi::GetCall& call) 46 static void ServeRoot(RestApiGetCall& call)
47 { 47 {
48 call.GetOutput().Redirect("app/explorer.html"); 48 call.GetOutput().Redirect("app/explorer.html");
49 } 49 }
50 50
51 static void GetSystemInformation(RestApi::GetCall& call) 51 static void GetSystemInformation(RestApiGetCall& call)
52 { 52 {
53 Json::Value result = Json::objectValue; 53 Json::Value result = Json::objectValue;
54 54
55 result["Version"] = ORTHANC_VERSION; 55 result["Version"] = ORTHANC_VERSION;
56 result["Name"] = Configuration::GetGlobalStringParameter("Name", ""); 56 result["Name"] = Configuration::GetGlobalStringParameter("Name", "");
57 57
58 call.GetOutput().AnswerJson(result); 58 call.GetOutput().AnswerJson(result);
59 } 59 }
60 60
61 static void GetStatistics(RestApi::GetCall& call) 61 static void GetStatistics(RestApiGetCall& call)
62 { 62 {
63 Json::Value result = Json::objectValue; 63 Json::Value result = Json::objectValue;
64 OrthancRestApi::GetIndex(call).ComputeStatistics(result); 64 OrthancRestApi::GetIndex(call).ComputeStatistics(result);
65 call.GetOutput().AnswerJson(result); 65 call.GetOutput().AnswerJson(result);
66 } 66 }
67 67
68 static void GenerateUid(RestApi::GetCall& call) 68 static void GenerateUid(RestApiGetCall& call)
69 { 69 {
70 std::string level = call.GetArgument("level", ""); 70 std::string level = call.GetArgument("level", "");
71 if (level == "patient") 71 if (level == "patient")
72 { 72 {
73 call.GetOutput().AnswerBuffer(FromDcmtkBridge::GenerateUniqueIdentifier(ResourceType_Patient), "text/plain"); 73 call.GetOutput().AnswerBuffer(FromDcmtkBridge::GenerateUniqueIdentifier(ResourceType_Patient), "text/plain");
84 { 84 {
85 call.GetOutput().AnswerBuffer(FromDcmtkBridge::GenerateUniqueIdentifier(ResourceType_Instance), "text/plain"); 85 call.GetOutput().AnswerBuffer(FromDcmtkBridge::GenerateUniqueIdentifier(ResourceType_Instance), "text/plain");
86 } 86 }
87 } 87 }
88 88
89 static void ExecuteScript(RestApi::PostCall& call) 89 static void ExecuteScript(RestApiPostCall& call)
90 { 90 {
91 std::string result; 91 std::string result;
92 ServerContext& context = OrthancRestApi::GetContext(call); 92 ServerContext& context = OrthancRestApi::GetContext(call);
93 context.GetLuaContext().Execute(result, call.GetPostBody()); 93
94 {
95 ServerContext::LuaContextLocker locker(context);
96 locker.GetLua().Execute(result, call.GetPostBody());
97 }
98
94 call.GetOutput().AnswerBuffer(result, "text/plain"); 99 call.GetOutput().AnswerBuffer(result, "text/plain");
95 } 100 }
96 101
97 static void GetNowIsoString(RestApi::GetCall& call) 102 static void GetNowIsoString(RestApiGetCall& call)
98 { 103 {
99 call.GetOutput().AnswerBuffer(Toolbox::GetNowIsoString(), "text/plain"); 104 call.GetOutput().AnswerBuffer(Toolbox::GetNowIsoString(), "text/plain");
100 } 105 }
101 106
102 void OrthancRestApi::RegisterSystem() 107 void OrthancRestApi::RegisterSystem()