Qore XmlRpcHandler Module Reference 1.1
Loading...
Searching...
No Matches
XmlRpcHandler.qm.dox.h
1// -*- mode: c++; indent-tabs-mode: nil -*-
3
4/* XmlRpcHandler.qm Copyright (C) 2012 - 2022 Qore Technologies, s.r.o.
5
6 Permission is hereby granted, free of charge, to any person obtaining a
7 copy of this software and associated documentation files (the "Software"),
8 to deal in the Software without restriction, including without limitation
9 the rights to use, copy, modify, merge, publish, distribute, sublicense,
10 and/or sell copies of the Software, and to permit persons to whom the
11 Software is furnished to do so, subject to the following conditions:
12
13 The above copyright notice and this permission notice shall be included in
14 all copies or substantial portions of the Software.
15
16 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21 FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22 DEALINGS IN THE SOFTWARE.
23*/
24
25// minimum qore version
26
27// requires the binary xml module
28
29// need mime definitions
30
31// need the Util module
32
33// need HttpServerUtil definitions
34
35// do not use $ for vars
36
37
38/* Version History
39 * 2012-05-31 v1.0: David Nichols <david@qore.org>: updated to a user module
40 * 2013-09-24 v1.1: David Nichols <david@qore.org>: added optional log closure to constructor
41*/
42
83namespace XmlRpcHandler {
85
87class XmlRpcHandler : public AbstractHttpRequestHandler {
88
89public:
91 const Version = "1.0";
92
94 const InternalMethods = ...;
95
96
98 const XMLRPC_INVALID_XML = 2001;
99
101protected:
102 list methods = ();
103 hash mi = hash();
104 int loglevel;
105
106 // if True then verbose exception info will be logged
107 bool debug;
108
109 // prefix to add to derived methods with GET requests if no "." characters are in the path
110 *string get_prefix;
111
112 // a closure/call reference to get the log message and/or process arguments in incoming requests
113 *code getLogMessage;
114
115 // a closure/call reference for logging (when set this is used instead of the HTTP server's logfunc for logging)
116 *code logc;
117
118public:
120
122
138 constructor(HttpServer::AbstractAuthenticator auth, list methods, *code n_getLogMessage, bool dbg = False, *string n_get_prefix, *code log) ;
139
140
142
149 addMethod(string name, code func, string text, string help, int logopt, auto cmark);
150
151
153 setDebug(bool dbg = True);
154
155
157 bool getDebug();
158
159
161 // don't reimplement this method; fix/enhance it in the module
162protected:
163 final addMethodInternal(hash h);
164public:
165
166
167protected:
168 hash help();
169public:
170
171
172protected:
173 list listMethods();
174public:
175
176
177protected:
178 log(hash cx, string str);
179public:
180
181
182 // don't reimplement this method; fix/enhance it in the module
183protected:
184 final hash<auto> callMethod(hash cx, auto params);
185public:
186
187
188 // method called by HttpServer to handle an XML-RPC request
189 // don't reimplement this method; fix/enhance it in the module
190 final hash handleRequest(hash cx, hash hdr, *data body);
191
193 };
194};
addMethod(string name, code func, string text, string help, int logopt, auto cmark)
adds a method to the handler dynamically
constructor(HttpServer::AbstractAuthenticator auth, list methods, *code n_getLogMessage, bool dbg=False, *string n_get_prefix, *code log)
creates the handler with the given method list
bool getDebug()
returns the current status of the debug flag
setDebug(bool dbg=True)
turns on or off debugging; when debugging is enabled more verbose error messages are reported
the XmlRpcHandler namespace holds all public definitions in the XmlRpcHandler module
Definition XmlRpcHandler.qm.dox.h:83