Mercurial > hg > orthanc
annotate OrthancFramework/Sources/HttpServer/HttpToolbox.h @ 4181:b416b6bf129b
clarification of sdk doc about deadlocks
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Tue, 08 Sep 2020 09:16:33 +0200 |
parents | bf7b9edf6b81 |
children | 83c5bd439fcc |
rev | line source |
---|---|
0 | 1 /** |
59 | 2 * Orthanc - A Lightweight, RESTful DICOM Store |
1900 | 3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics |
1288
6e7e5ed91c2d
upgrade to year 2015
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
912
diff
changeset
|
4 * Department, University Hospital of Liege, Belgium |
3640
94f4a18a79cc
upgrade to year 2020
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3442
diff
changeset
|
5 * Copyright (C) 2017-2020 Osimis S.A., Belgium |
0 | 6 * |
7 * This program is free software: you can redistribute it and/or | |
4119
bf7b9edf6b81
re-licensing the OrthancFramework to LGPL, in order to license Stone of Orthanc under LGPL
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4044
diff
changeset
|
8 * modify it under the terms of the GNU Lesser General Public License |
bf7b9edf6b81
re-licensing the OrthancFramework to LGPL, in order to license Stone of Orthanc under LGPL
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4044
diff
changeset
|
9 * as published by the Free Software Foundation, either version 3 of |
bf7b9edf6b81
re-licensing the OrthancFramework to LGPL, in order to license Stone of Orthanc under LGPL
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4044
diff
changeset
|
10 * the License, or (at your option) any later version. |
136 | 11 * |
0 | 12 * This program is distributed in the hope that it will be useful, but |
13 * WITHOUT ANY WARRANTY; without even the implied warranty of | |
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
4119
bf7b9edf6b81
re-licensing the OrthancFramework to LGPL, in order to license Stone of Orthanc under LGPL
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4044
diff
changeset
|
15 * Lesser General Public License for more details. |
0 | 16 * |
4119
bf7b9edf6b81
re-licensing the OrthancFramework to LGPL, in order to license Stone of Orthanc under LGPL
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4044
diff
changeset
|
17 * You should have received a copy of the GNU Lesser General Public |
bf7b9edf6b81
re-licensing the OrthancFramework to LGPL, in order to license Stone of Orthanc under LGPL
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4044
diff
changeset
|
18 * License along with this program. If not, see |
bf7b9edf6b81
re-licensing the OrthancFramework to LGPL, in order to license Stone of Orthanc under LGPL
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4044
diff
changeset
|
19 * <http://www.gnu.org/licenses/>. |
0 | 20 **/ |
21 | |
22 | |
23 #pragma once | |
24 | |
3992
f9863630ec7f
working on the shared library for Orthanc framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
25 #include "../OrthancFramework.h" |
1441
f3672356c121
refactoring: IHttpHandler and HttpToolbox
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1437
diff
changeset
|
26 #include "IHttpHandler.h" |
0 | 27 |
59 | 28 namespace Orthanc |
0 | 29 { |
3992
f9863630ec7f
working on the shared library for Orthanc framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
30 class ORTHANC_PUBLIC HttpToolbox : public boost::noncopyable |
0 | 31 { |
32 public: | |
1441
f3672356c121
refactoring: IHttpHandler and HttpToolbox
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1437
diff
changeset
|
33 static void ParseGetArguments(IHttpHandler::GetArguments& result, |
912
dcb2469f00f4
PluginsHttpHandler::RestApiGet
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
901
diff
changeset
|
34 const char* query); |
dcb2469f00f4
PluginsHttpHandler::RestApiGet
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
901
diff
changeset
|
35 |
dcb2469f00f4
PluginsHttpHandler::RestApiGet
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
901
diff
changeset
|
36 static void ParseGetQuery(UriComponents& uri, |
1441
f3672356c121
refactoring: IHttpHandler and HttpToolbox
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1437
diff
changeset
|
37 IHttpHandler::GetArguments& getArguments, |
0 | 38 const char* query); |
39 | |
1441
f3672356c121
refactoring: IHttpHandler and HttpToolbox
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1437
diff
changeset
|
40 static std::string GetArgument(const IHttpHandler::Arguments& getArguments, |
0 | 41 const std::string& name, |
42 const std::string& defaultValue); | |
330 | 43 |
1441
f3672356c121
refactoring: IHttpHandler and HttpToolbox
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1437
diff
changeset
|
44 static std::string GetArgument(const IHttpHandler::GetArguments& getArguments, |
1363
feaf2840917c
Plugins now receive duplicated GET arguments in their REST callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1288
diff
changeset
|
45 const std::string& name, |
feaf2840917c
Plugins now receive duplicated GET arguments in their REST callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1288
diff
changeset
|
46 const std::string& defaultValue); |
feaf2840917c
Plugins now receive duplicated GET arguments in their REST callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1288
diff
changeset
|
47 |
1441
f3672356c121
refactoring: IHttpHandler and HttpToolbox
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1437
diff
changeset
|
48 static void ParseCookies(IHttpHandler::Arguments& result, |
f3672356c121
refactoring: IHttpHandler and HttpToolbox
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1437
diff
changeset
|
49 const IHttpHandler::Arguments& httpHeaders); |
1363
feaf2840917c
Plugins now receive duplicated GET arguments in their REST callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1288
diff
changeset
|
50 |
1441
f3672356c121
refactoring: IHttpHandler and HttpToolbox
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1437
diff
changeset
|
51 static void CompileGetArguments(IHttpHandler::Arguments& compiled, |
f3672356c121
refactoring: IHttpHandler and HttpToolbox
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1437
diff
changeset
|
52 const IHttpHandler::GetArguments& source); |
1437
02f5a3f5c0a0
access to the REST API from Lua
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1363
diff
changeset
|
53 |
1447
5ba7471780ae
refactoring: HttpToolbox, DumpJson in Lua
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1441
diff
changeset
|
54 static bool SimpleGet(std::string& result, |
1441
f3672356c121
refactoring: IHttpHandler and HttpToolbox
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1437
diff
changeset
|
55 IHttpHandler& handler, |
1571
3232f1c995a5
provide the origin of the requests to HTTP handlers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1447
diff
changeset
|
56 RequestOrigin origin, |
1780
94990da8710e
OrthancPluginRestApiGet2
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1571
diff
changeset
|
57 const std::string& uri, |
94990da8710e
OrthancPluginRestApiGet2
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1571
diff
changeset
|
58 const IHttpHandler::Arguments& httpHeaders); |
94990da8710e
OrthancPluginRestApiGet2
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1571
diff
changeset
|
59 |
1447
5ba7471780ae
refactoring: HttpToolbox, DumpJson in Lua
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1441
diff
changeset
|
60 static bool SimplePost(std::string& result, |
5ba7471780ae
refactoring: HttpToolbox, DumpJson in Lua
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1441
diff
changeset
|
61 IHttpHandler& handler, |
1571
3232f1c995a5
provide the origin of the requests to HTTP handlers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1447
diff
changeset
|
62 RequestOrigin origin, |
1447
5ba7471780ae
refactoring: HttpToolbox, DumpJson in Lua
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1441
diff
changeset
|
63 const std::string& uri, |
3401 | 64 const void* bodyData, |
3442
dd1e68f2d0c0
Fix issue #106 (Unable to export preview as jpeg from Lua script)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3401
diff
changeset
|
65 size_t bodySize, |
dd1e68f2d0c0
Fix issue #106 (Unable to export preview as jpeg from Lua script)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3401
diff
changeset
|
66 const IHttpHandler::Arguments& httpHeaders); |
1447
5ba7471780ae
refactoring: HttpToolbox, DumpJson in Lua
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1441
diff
changeset
|
67 |
5ba7471780ae
refactoring: HttpToolbox, DumpJson in Lua
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1441
diff
changeset
|
68 static bool SimplePut(std::string& result, |
5ba7471780ae
refactoring: HttpToolbox, DumpJson in Lua
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1441
diff
changeset
|
69 IHttpHandler& handler, |
1571
3232f1c995a5
provide the origin of the requests to HTTP handlers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1447
diff
changeset
|
70 RequestOrigin origin, |
1447
5ba7471780ae
refactoring: HttpToolbox, DumpJson in Lua
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1441
diff
changeset
|
71 const std::string& uri, |
3401 | 72 const void* bodyData, |
3442
dd1e68f2d0c0
Fix issue #106 (Unable to export preview as jpeg from Lua script)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3401
diff
changeset
|
73 size_t bodySize, |
dd1e68f2d0c0
Fix issue #106 (Unable to export preview as jpeg from Lua script)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3401
diff
changeset
|
74 const IHttpHandler::Arguments& httpHeaders); |
1447
5ba7471780ae
refactoring: HttpToolbox, DumpJson in Lua
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1441
diff
changeset
|
75 |
5ba7471780ae
refactoring: HttpToolbox, DumpJson in Lua
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1441
diff
changeset
|
76 static bool SimpleDelete(IHttpHandler& handler, |
1571
3232f1c995a5
provide the origin of the requests to HTTP handlers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1447
diff
changeset
|
77 RequestOrigin origin, |
3442
dd1e68f2d0c0
Fix issue #106 (Unable to export preview as jpeg from Lua script)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3401
diff
changeset
|
78 const std::string& uri, |
dd1e68f2d0c0
Fix issue #106 (Unable to export preview as jpeg from Lua script)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3401
diff
changeset
|
79 const IHttpHandler::Arguments& httpHeaders); |
0 | 80 }; |
81 } |