annotate OrthancServer/OrthancRestApi/OrthancRestSystem.cpp @ 1656:d3ba98d6b6e9

refactoring
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 29 Sep 2015 15:13:34 +0200
parents eb8fbcf008b5
children de1413733c97
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
751
5197fd35333c refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1 /**
5197fd35333c refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2 * Orthanc - A Lightweight, RESTful DICOM Store
1288
6e7e5ed91c2d upgrade to year 2015
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1233
diff changeset
3 * Copyright (C) 2012-2015 Sebastien Jodogne, Medical Physics
6e7e5ed91c2d upgrade to year 2015
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1233
diff changeset
4 * Department, University Hospital of Liege, Belgium
751
5197fd35333c refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5 *
5197fd35333c refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6 * This program is free software: you can redistribute it and/or
5197fd35333c refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7 * modify it under the terms of the GNU General Public License as
5197fd35333c refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8 * published by the Free Software Foundation, either version 3 of the
5197fd35333c refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9 * License, or (at your option) any later version.
5197fd35333c refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
10 *
5197fd35333c refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
11 * In addition, as a special exception, the copyright holders of this
5197fd35333c refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
12 * program give permission to link the code of its release with the
5197fd35333c refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
13 * OpenSSL project's "OpenSSL" library (or with modified versions of it
5197fd35333c refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
14 * that use the same license as the "OpenSSL" library), and distribute
5197fd35333c refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
15 * the linked executables. You must obey the GNU General Public License
5197fd35333c refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
16 * in all respects for all of the code used other than "OpenSSL". If you
5197fd35333c refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
17 * modify file(s) with this exception, you may extend this exception to
5197fd35333c refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
18 * your version of the file(s), but you are not obligated to do so. If
5197fd35333c refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
19 * you do not wish to do so, delete this exception statement from your
5197fd35333c refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
20 * version. If you delete this exception statement from all source files
5197fd35333c refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
21 * in the program, then also delete it here.
5197fd35333c refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
22 *
5197fd35333c refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
23 * This program is distributed in the hope that it will be useful, but
5197fd35333c refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
24 * WITHOUT ANY WARRANTY; without even the implied warranty of
5197fd35333c refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
25 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
5197fd35333c refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
26 * General Public License for more details.
5197fd35333c refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
27 *
5197fd35333c refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
28 * You should have received a copy of the GNU General Public License
5197fd35333c refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
29 * along with this program. If not, see <http://www.gnu.org/licenses/>.
5197fd35333c refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
30 **/
5197fd35333c refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
31
5197fd35333c refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
32
831
84513f2ee1f3 pch for unit tests and server
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 824
diff changeset
33 #include "../PrecompiledHeadersServer.h"
751
5197fd35333c refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
34 #include "OrthancRestApi.h"
5197fd35333c refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
35
5197fd35333c refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
36 #include "../OrthancInitialization.h"
795
d466b3606aca refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 788
diff changeset
37 #include "../FromDcmtkBridge.h"
1232
f1c01451a8ee Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1218
diff changeset
38 #include "../../Plugins/Engine/PluginsManager.h"
f1c01451a8ee Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1218
diff changeset
39 #include "../../Plugins/Engine/OrthancPlugins.h"
1437
02f5a3f5c0a0 access to the REST API from Lua
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1434
diff changeset
40 #include "../ServerContext.h"
751
5197fd35333c refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
41
5197fd35333c refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
42
5197fd35333c refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
43 namespace Orthanc
5197fd35333c refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
44 {
5197fd35333c refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
45 // System information -------------------------------------------------------
5197fd35333c refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
46
974
83622b0f544c refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
47 static void ServeRoot(RestApiGetCall& call)
751
5197fd35333c refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
48 {
5197fd35333c refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
49 call.GetOutput().Redirect("app/explorer.html");
5197fd35333c refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
50 }
5197fd35333c refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
51
974
83622b0f544c refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
52 static void GetSystemInformation(RestApiGetCall& call)
751
5197fd35333c refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
53 {
5197fd35333c refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
54 Json::Value result = Json::objectValue;
5197fd35333c refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
55
1369
4460e2622016 more information in /system
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1303
diff changeset
56 std::string dbVersion = OrthancRestApi::GetIndex(call).GetGlobalProperty(GlobalProperty_DatabaseSchemaVersion, "0");
4460e2622016 more information in /system
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1303
diff changeset
57
4460e2622016 more information in /system
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1303
diff changeset
58 result["DatabaseVersion"] = boost::lexical_cast<int>(dbVersion);
4460e2622016 more information in /system
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1303
diff changeset
59 result["DicomAet"] = Configuration::GetGlobalStringParameter("DicomAet", "ORTHANC");
4460e2622016 more information in /system
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1303
diff changeset
60 result["DicomPort"] = Configuration::GetGlobalIntegerParameter("DicomPort", 4242);
4460e2622016 more information in /system
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1303
diff changeset
61 result["HttpPort"] = Configuration::GetGlobalIntegerParameter("HttpPort", 8042);
810
401a9633e492 configuration into a namespace
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 795
diff changeset
62 result["Name"] = Configuration::GetGlobalStringParameter("Name", "");
1369
4460e2622016 more information in /system
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1303
diff changeset
63 result["Version"] = ORTHANC_VERSION;
751
5197fd35333c refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
64
1630
ffd23c0104af "/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1597
diff changeset
65 result["StorageAreaPlugin"] = Json::nullValue;
ffd23c0104af "/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1597
diff changeset
66 result["DatabaseBackendPlugin"] = Json::nullValue;
ffd23c0104af "/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1597
diff changeset
67
1632
eb8fbcf008b5 fix build with plugins disabled
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1631
diff changeset
68 #if ORTHANC_PLUGINS_ENABLED == 1
eb8fbcf008b5 fix build with plugins disabled
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1631
diff changeset
69 result["PluginsEnabled"] = true;
1630
ffd23c0104af "/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1597
diff changeset
70 const OrthancPlugins& plugins = OrthancRestApi::GetContext(call).GetPlugins();
ffd23c0104af "/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1597
diff changeset
71
ffd23c0104af "/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1597
diff changeset
72 if (plugins.HasStorageArea())
ffd23c0104af "/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1597
diff changeset
73 {
1631
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1630
diff changeset
74 std::string p = plugins.GetStorageAreaLibrary().GetPath();
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1630
diff changeset
75 result["StorageAreaPlugin"] = boost::filesystem::canonical(p).string();
1630
ffd23c0104af "/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1597
diff changeset
76 }
ffd23c0104af "/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1597
diff changeset
77
ffd23c0104af "/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1597
diff changeset
78 if (plugins.HasDatabaseBackend())
ffd23c0104af "/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1597
diff changeset
79 {
1631
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1630
diff changeset
80 std::string p = plugins.GetDatabaseBackendLibrary().GetPath();
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1630
diff changeset
81 result["DatabaseBackendPlugin"] = boost::filesystem::canonical(p).string();
1630
ffd23c0104af "/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1597
diff changeset
82 }
1632
eb8fbcf008b5 fix build with plugins disabled
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1631
diff changeset
83 #else
eb8fbcf008b5 fix build with plugins disabled
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1631
diff changeset
84 result["PluginsEnabled"] = false;
eb8fbcf008b5 fix build with plugins disabled
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1631
diff changeset
85 #endif
1630
ffd23c0104af "/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1597
diff changeset
86
751
5197fd35333c refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
87 call.GetOutput().AnswerJson(result);
5197fd35333c refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
88 }
5197fd35333c refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
89
974
83622b0f544c refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
90 static void GetStatistics(RestApiGetCall& call)
751
5197fd35333c refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
91 {
5197fd35333c refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
92 Json::Value result = Json::objectValue;
5197fd35333c refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
93 OrthancRestApi::GetIndex(call).ComputeStatistics(result);
5197fd35333c refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
94 call.GetOutput().AnswerJson(result);
5197fd35333c refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
95 }
5197fd35333c refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
96
974
83622b0f544c refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
97 static void GenerateUid(RestApiGetCall& call)
751
5197fd35333c refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
98 {
5197fd35333c refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
99 std::string level = call.GetArgument("level", "");
5197fd35333c refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
100 if (level == "patient")
5197fd35333c refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
101 {
788
7ebe4bf87196 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 751
diff changeset
102 call.GetOutput().AnswerBuffer(FromDcmtkBridge::GenerateUniqueIdentifier(ResourceType_Patient), "text/plain");
751
5197fd35333c refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
103 }
5197fd35333c refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
104 else if (level == "study")
5197fd35333c refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
105 {
788
7ebe4bf87196 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 751
diff changeset
106 call.GetOutput().AnswerBuffer(FromDcmtkBridge::GenerateUniqueIdentifier(ResourceType_Study), "text/plain");
751
5197fd35333c refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
107 }
5197fd35333c refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
108 else if (level == "series")
5197fd35333c refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
109 {
788
7ebe4bf87196 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 751
diff changeset
110 call.GetOutput().AnswerBuffer(FromDcmtkBridge::GenerateUniqueIdentifier(ResourceType_Series), "text/plain");
751
5197fd35333c refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
111 }
5197fd35333c refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
112 else if (level == "instance")
5197fd35333c refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
113 {
788
7ebe4bf87196 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 751
diff changeset
114 call.GetOutput().AnswerBuffer(FromDcmtkBridge::GenerateUniqueIdentifier(ResourceType_Instance), "text/plain");
751
5197fd35333c refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
115 }
5197fd35333c refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
116 }
5197fd35333c refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
117
974
83622b0f544c refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
118 static void ExecuteScript(RestApiPostCall& call)
751
5197fd35333c refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
119 {
5197fd35333c refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
120 std::string result;
5197fd35333c refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
121 ServerContext& context = OrthancRestApi::GetContext(call);
996
cf52f3bcb2b3 clarification of Lua classes wrt multithreading
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 974
diff changeset
122
1446
8dc80ba768aa refactoring: IHttpHandler does not use std::string to hold the request body
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1437
diff changeset
123 std::string command;
8dc80ba768aa refactoring: IHttpHandler does not use std::string to hold the request body
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1437
diff changeset
124 call.BodyToString(command);
8dc80ba768aa refactoring: IHttpHandler does not use std::string to hold the request body
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1437
diff changeset
125
996
cf52f3bcb2b3 clarification of Lua classes wrt multithreading
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 974
diff changeset
126 {
1433
461e7554bff7 refactoring: LuaScripting
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1369
diff changeset
127 LuaScripting::Locker locker(context.GetLua());
1446
8dc80ba768aa refactoring: IHttpHandler does not use std::string to hold the request body
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1437
diff changeset
128 locker.GetLua().Execute(result, command);
996
cf52f3bcb2b3 clarification of Lua classes wrt multithreading
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 974
diff changeset
129 }
cf52f3bcb2b3 clarification of Lua classes wrt multithreading
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 974
diff changeset
130
751
5197fd35333c refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
131 call.GetOutput().AnswerBuffer(result, "text/plain");
5197fd35333c refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
132 }
5197fd35333c refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
133
974
83622b0f544c refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
134 static void GetNowIsoString(RestApiGetCall& call)
751
5197fd35333c refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
135 {
5197fd35333c refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
136 call.GetOutput().AnswerBuffer(Toolbox::GetNowIsoString(), "text/plain");
5197fd35333c refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
137 }
5197fd35333c refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
138
1073
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 996
diff changeset
139
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 996
diff changeset
140 static void GetDicomConformanceStatement(RestApiGetCall& call)
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 996
diff changeset
141 {
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 996
diff changeset
142 std::string statement;
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 996
diff changeset
143 GetFileResource(statement, EmbeddedResources::DICOM_CONFORMANCE_STATEMENT);
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 996
diff changeset
144 call.GetOutput().AnswerBuffer(statement, "text/plain");
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 996
diff changeset
145 }
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 996
diff changeset
146
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 996
diff changeset
147
1232
f1c01451a8ee Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1218
diff changeset
148 // Plugins information ------------------------------------------------------
f1c01451a8ee Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1218
diff changeset
149
f1c01451a8ee Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1218
diff changeset
150 static void ListPlugins(RestApiGetCall& call)
f1c01451a8ee Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1218
diff changeset
151 {
f1c01451a8ee Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1218
diff changeset
152 Json::Value v = Json::arrayValue;
f1c01451a8ee Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1218
diff changeset
153
1233
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1232
diff changeset
154 v.append("explorer.js");
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1232
diff changeset
155
1232
f1c01451a8ee Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1218
diff changeset
156 if (OrthancRestApi::GetContext(call).HasPlugins())
f1c01451a8ee Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1218
diff changeset
157 {
1632
eb8fbcf008b5 fix build with plugins disabled
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1631
diff changeset
158 #if ORTHANC_PLUGINS_ENABLED == 1
1232
f1c01451a8ee Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1218
diff changeset
159 std::list<std::string> plugins;
1434
f9cd40166269 refactoring of OrthancPlugins, improvement in ServeFolders
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1433
diff changeset
160 OrthancRestApi::GetContext(call).GetPlugins().GetManager().ListPlugins(plugins);
1232
f1c01451a8ee Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1218
diff changeset
161
f1c01451a8ee Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1218
diff changeset
162 for (std::list<std::string>::const_iterator
1303
bba8a47922d1 cppcheck
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1288
diff changeset
163 it = plugins.begin(); it != plugins.end(); ++it)
1232
f1c01451a8ee Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1218
diff changeset
164 {
f1c01451a8ee Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1218
diff changeset
165 v.append(*it);
f1c01451a8ee Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1218
diff changeset
166 }
1632
eb8fbcf008b5 fix build with plugins disabled
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1631
diff changeset
167 #endif
1232
f1c01451a8ee Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1218
diff changeset
168 }
f1c01451a8ee Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1218
diff changeset
169
f1c01451a8ee Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1218
diff changeset
170 call.GetOutput().AnswerJson(v);
f1c01451a8ee Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1218
diff changeset
171 }
f1c01451a8ee Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1218
diff changeset
172
f1c01451a8ee Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1218
diff changeset
173
f1c01451a8ee Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1218
diff changeset
174 static void GetPlugin(RestApiGetCall& call)
f1c01451a8ee Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1218
diff changeset
175 {
f1c01451a8ee Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1218
diff changeset
176 if (!OrthancRestApi::GetContext(call).HasPlugins())
f1c01451a8ee Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1218
diff changeset
177 {
f1c01451a8ee Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1218
diff changeset
178 return;
f1c01451a8ee Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1218
diff changeset
179 }
f1c01451a8ee Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1218
diff changeset
180
1632
eb8fbcf008b5 fix build with plugins disabled
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1631
diff changeset
181 #if ORTHANC_PLUGINS_ENABLED == 1
1434
f9cd40166269 refactoring of OrthancPlugins, improvement in ServeFolders
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1433
diff changeset
182 const PluginsManager& manager = OrthancRestApi::GetContext(call).GetPlugins().GetManager();
1232
f1c01451a8ee Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1218
diff changeset
183 std::string id = call.GetUriComponent("id", "");
f1c01451a8ee Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1218
diff changeset
184
f1c01451a8ee Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1218
diff changeset
185 if (manager.HasPlugin(id))
f1c01451a8ee Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1218
diff changeset
186 {
f1c01451a8ee Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1218
diff changeset
187 Json::Value v = Json::objectValue;
f1c01451a8ee Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1218
diff changeset
188 v["ID"] = id;
f1c01451a8ee Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1218
diff changeset
189 v["Version"] = manager.GetPluginVersion(id);
f1c01451a8ee Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1218
diff changeset
190
1434
f9cd40166269 refactoring of OrthancPlugins, improvement in ServeFolders
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1433
diff changeset
191 const OrthancPlugins& plugins = OrthancRestApi::GetContext(call).GetPlugins();
1232
f1c01451a8ee Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1218
diff changeset
192 const char *c = plugins.GetProperty(id.c_str(), _OrthancPluginProperty_RootUri);
f1c01451a8ee Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1218
diff changeset
193 if (c != NULL)
f1c01451a8ee Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1218
diff changeset
194 {
1597
415dfd1d1c61 Improvements to the sample "ServeFolders" plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1486
diff changeset
195 std::string root = c;
415dfd1d1c61 Improvements to the sample "ServeFolders" plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1486
diff changeset
196 if (!root.empty())
415dfd1d1c61 Improvements to the sample "ServeFolders" plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1486
diff changeset
197 {
415dfd1d1c61 Improvements to the sample "ServeFolders" plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1486
diff changeset
198 // Turn the root URI into a URI relative to "/app/explorer.js"
415dfd1d1c61 Improvements to the sample "ServeFolders" plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1486
diff changeset
199 if (root[0] == '/')
415dfd1d1c61 Improvements to the sample "ServeFolders" plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1486
diff changeset
200 {
415dfd1d1c61 Improvements to the sample "ServeFolders" plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1486
diff changeset
201 root = ".." + root;
415dfd1d1c61 Improvements to the sample "ServeFolders" plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1486
diff changeset
202 }
415dfd1d1c61 Improvements to the sample "ServeFolders" plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1486
diff changeset
203
415dfd1d1c61 Improvements to the sample "ServeFolders" plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1486
diff changeset
204 v["RootUri"] = root;
415dfd1d1c61 Improvements to the sample "ServeFolders" plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1486
diff changeset
205 }
1232
f1c01451a8ee Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1218
diff changeset
206 }
f1c01451a8ee Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1218
diff changeset
207
f1c01451a8ee Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1218
diff changeset
208 c = plugins.GetProperty(id.c_str(), _OrthancPluginProperty_Description);
f1c01451a8ee Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1218
diff changeset
209 if (c != NULL)
f1c01451a8ee Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1218
diff changeset
210 {
f1c01451a8ee Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1218
diff changeset
211 v["Description"] = c;
f1c01451a8ee Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1218
diff changeset
212 }
f1c01451a8ee Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1218
diff changeset
213
f1c01451a8ee Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1218
diff changeset
214 c = plugins.GetProperty(id.c_str(), _OrthancPluginProperty_OrthancExplorer);
f1c01451a8ee Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1218
diff changeset
215 v["ExtendsOrthancExplorer"] = (c != NULL);
f1c01451a8ee Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1218
diff changeset
216
f1c01451a8ee Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1218
diff changeset
217 call.GetOutput().AnswerJson(v);
f1c01451a8ee Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1218
diff changeset
218 }
1632
eb8fbcf008b5 fix build with plugins disabled
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1631
diff changeset
219 #endif
1232
f1c01451a8ee Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1218
diff changeset
220 }
f1c01451a8ee Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1218
diff changeset
221
f1c01451a8ee Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1218
diff changeset
222
f1c01451a8ee Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1218
diff changeset
223 static void GetOrthancExplorerPlugins(RestApiGetCall& call)
f1c01451a8ee Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1218
diff changeset
224 {
f1c01451a8ee Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1218
diff changeset
225 std::string s = "// Extensions to Orthanc Explorer by the registered plugins\n\n";
f1c01451a8ee Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1218
diff changeset
226
f1c01451a8ee Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1218
diff changeset
227 if (OrthancRestApi::GetContext(call).HasPlugins())
f1c01451a8ee Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1218
diff changeset
228 {
1632
eb8fbcf008b5 fix build with plugins disabled
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1631
diff changeset
229 #if ORTHANC_PLUGINS_ENABLED == 1
1434
f9cd40166269 refactoring of OrthancPlugins, improvement in ServeFolders
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1433
diff changeset
230 const OrthancPlugins& plugins = OrthancRestApi::GetContext(call).GetPlugins();
f9cd40166269 refactoring of OrthancPlugins, improvement in ServeFolders
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1433
diff changeset
231 const PluginsManager& manager = plugins.GetManager();
1232
f1c01451a8ee Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1218
diff changeset
232
f1c01451a8ee Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1218
diff changeset
233 std::list<std::string> lst;
1434
f9cd40166269 refactoring of OrthancPlugins, improvement in ServeFolders
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1433
diff changeset
234 manager.ListPlugins(lst);
1232
f1c01451a8ee Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1218
diff changeset
235
f1c01451a8ee Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1218
diff changeset
236 for (std::list<std::string>::const_iterator
1303
bba8a47922d1 cppcheck
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1288
diff changeset
237 it = lst.begin(); it != lst.end(); ++it)
1232
f1c01451a8ee Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1218
diff changeset
238 {
f1c01451a8ee Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1218
diff changeset
239 const char* tmp = plugins.GetProperty(it->c_str(), _OrthancPluginProperty_OrthancExplorer);
f1c01451a8ee Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1218
diff changeset
240 if (tmp != NULL)
f1c01451a8ee Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1218
diff changeset
241 {
f1c01451a8ee Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1218
diff changeset
242 s += "/**\n * From plugin: " + *it + " (version " + manager.GetPluginVersion(*it) + ")\n **/\n\n";
f1c01451a8ee Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1218
diff changeset
243 s += std::string(tmp) + "\n\n";
f1c01451a8ee Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1218
diff changeset
244 }
f1c01451a8ee Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1218
diff changeset
245 }
1632
eb8fbcf008b5 fix build with plugins disabled
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1631
diff changeset
246 #endif
1232
f1c01451a8ee Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1218
diff changeset
247 }
f1c01451a8ee Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1218
diff changeset
248
f1c01451a8ee Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1218
diff changeset
249 call.GetOutput().AnswerBuffer(s, "application/javascript");
f1c01451a8ee Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1218
diff changeset
250 }
f1c01451a8ee Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1218
diff changeset
251
f1c01451a8ee Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1218
diff changeset
252
751
5197fd35333c refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
253 void OrthancRestApi::RegisterSystem()
5197fd35333c refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
254 {
5197fd35333c refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
255 Register("/", ServeRoot);
5197fd35333c refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
256 Register("/system", GetSystemInformation);
5197fd35333c refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
257 Register("/statistics", GetStatistics);
5197fd35333c refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
258 Register("/tools/generate-uid", GenerateUid);
5197fd35333c refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
259 Register("/tools/execute-script", ExecuteScript);
5197fd35333c refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
260 Register("/tools/now", GetNowIsoString);
1073
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 996
diff changeset
261 Register("/tools/dicom-conformance", GetDicomConformanceStatement);
1232
f1c01451a8ee Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1218
diff changeset
262
f1c01451a8ee Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1218
diff changeset
263 Register("/plugins", ListPlugins);
f1c01451a8ee Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1218
diff changeset
264 Register("/plugins/{id}", GetPlugin);
f1c01451a8ee Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1218
diff changeset
265 Register("/plugins/explorer.js", GetOrthancExplorerPlugins);
751
5197fd35333c refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
266 }
5197fd35333c refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
267 }